add .onion website to the pre-push script

for now I need to upload the website two times
(normal, onion)

I will need a script on the server to replicate the website
and change domains (but we will then have to remove the tracking
scripts too)
This commit is contained in:
Dominic Reich 2025-01-05 10:05:35 +01:00
parent 20dd57d1d3
commit e8bf4e32d0
Signed by: dominic
GPG key ID: 0B5787DB23049C45

View file

@ -4,7 +4,7 @@
# created: 2023-03-26T23:27:11+0200 # created: 2023-03-26T23:27:11+0200
clean_up () { clean_up () {
echo -n ">>> Removing output files..." echo -en "\n>>> Removing output files..."
rm -rf public rm -rf public
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
echo " Success!" echo " Success!"
@ -13,9 +13,16 @@ clean_up () {
echo "Could not delete output files (public). Aborting..." echo "Could not delete output files (public). Aborting..."
exit 1 exit 1
fi fi
echo
} }
echo -n ">>> Creating static files with `hugo version | awk '{ print $1,$2 }'`..." # git lfs
echo -n ">>> Check for git-lfs..."
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"
echo " Done!"
echo -en "\n>>> Creating static files with `hugo version | awk '{ print $1,$2 }'` (oe7drt.com)..."
ret="$(hugo --gc --minify --printPathWarnings --logLevel warn)" ret="$(hugo --gc --minify --printPathWarnings --logLevel warn)"
@ -30,26 +37,7 @@ else
exit 1 exit 1
fi fi
# git lfs echo -n ">>> Pushing files to *celeste* (oe7drt.com)..."
echo -n ">>> Check for git-lfs..."
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"
echo " Done!"
# echo -n ">>> Pushing files to *bor* (old server)..."
#
# ret="$(rsync --no-motd -acvhz --stats --del public/ bor:/var/www/sites/oe7drt/ > /dev/null 2>&1)"
#
# if [ "$?" -eq "0" ] ; then
# echo " Success!"
# else
# echo " *** FAILED ***"
# echo "Could not sync files to *bor* (rsync). Aborting..."
# clean_up
# exit 1
# fi
echo -n ">>> Pushing files to *celeste* (new server)..."
ret="$(rsync --no-motd -acvhz --stats --del public/ celeste:/srv/sites/oe7drt/ > /dev/null 2>&1)" ret="$(rsync --no-motd -acvhz --stats --del public/ celeste:/srv/sites/oe7drt/ > /dev/null 2>&1)"
@ -64,3 +52,35 @@ fi
clean_up clean_up
# ==============================================================
# 5uxkejb6la7olhncaotybxrscmdlbxwy64ucuyrum4tsgfuoxbyav2qd.onion
echo -en "\n>>> Creating static files with `hugo version | awk '{ print $1,$2 }'` (onion services)..."
ret="$(hugo --gc --minify --printPathWarnings --logLevel warn --baseURL http://5uxkejb6la7olhncaotybxrscmdlbxwy64ucuyrum4tsgfuoxbyav2qd.onion/)"
# if [ -n "$(echo $ret | grep Total)" ] ; then
if [ "$?" -eq "0" ] ; then
echo " Success!"
else
echo " *** FAILED ***"
echo "Could not create static files (hugo). Aborting..."
clean_up
# exit with 1, so the update does not proceed, so we will know
exit 1
fi
echo -n ">>> Pushing files to *celeste* (onion services)..."
ret="$(rsync --no-motd -acvhz --stats --del public/ celeste:/srv/sites/oe7drt-onion/ > /dev/null 2>&1)"
if [ "$?" -eq "0" ] ; then
echo " Success!"
else
echo " *** FAILED ***"
echo "Could not sync files to *celeste* (rsync). Aborting..."
clean_up
exit 1
fi
clean_up