update git hook pre-push
This commit is contained in:
parent
e3bb200937
commit
968709e1fe
1 changed files with 20 additions and 4 deletions
|
@ -3,7 +3,19 @@
|
||||||
# to my webserver
|
# to my webserver
|
||||||
# created: 2023-03-26T23:27:11+0200
|
# created: 2023-03-26T23:27:11+0200
|
||||||
|
|
||||||
echo -n "creating website..."
|
clean_up () {
|
||||||
|
echo -n ">>> Removing output files..."
|
||||||
|
rm -rf public
|
||||||
|
if [ "$?" -eq "0" ]; then
|
||||||
|
echo " Success!"
|
||||||
|
else
|
||||||
|
echo " *** FAILED ***"
|
||||||
|
echo "Could not delete output files (public). Aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo -n ">>> Creating static files with `hugo version | awk '{ print $1,$2 }'`..."
|
||||||
|
|
||||||
ret="$(hugo --gc --minify)"
|
ret="$(hugo --gc --minify)"
|
||||||
|
|
||||||
|
@ -13,19 +25,23 @@ if [ "$?" -eq "0" ] ; then
|
||||||
else
|
else
|
||||||
echo " *** FAILED ***"
|
echo " *** FAILED ***"
|
||||||
echo "Could not create static files (hugo). Aborting..."
|
echo "Could not create static files (hugo). Aborting..."
|
||||||
|
clean_up
|
||||||
# exit with 1, so the update does not proceed, so we will know
|
# exit with 1, so the update does not proceed, so we will know
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "rsyncing files to server..."
|
echo -n ">>> Pushing files to server..."
|
||||||
|
|
||||||
ret="$(rsync -avhzP --stats --del public/ bor:/var/www/sites/oe7drt/)"
|
ret="$(rsync -avhzP --stats --del public/ bor:/var/www/sites/oe7drt/ > /dev/null 2>&1)"
|
||||||
|
|
||||||
if [ "$?" -eq "0" ] ; then
|
if [ "$?" -eq "0" ] ; then
|
||||||
echo "Success!"
|
echo " Success!"
|
||||||
else
|
else
|
||||||
echo " *** FAILED ***"
|
echo " *** FAILED ***"
|
||||||
echo "Could not sync files to webserver (rsync). Aborting..."
|
echo "Could not sync files to webserver (rsync). Aborting..."
|
||||||
|
clean_up
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
clean_up
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue