adds git hooks/post-receive.d/publish-website hook

main
Dominic Reich 2 years ago
parent 7a9602331f
commit 2c17785f95
Signed by: dominic
GPG Key ID: BC9D6AE1A3BE169A

@ -0,0 +1,19 @@
#!/usr/bin/env bash
GIT_REPO=/var/lib/gitea/data/gitea-repositories/dominic/oe7drt-website.git
WORKING_DIR=${HOME}/oe7drt-website-working
PUBLIC_WWW=/var/www/oe7drt
BACKUP_WWW=/var/www/oe7drt-backup
MY_DOMAIN=oe7drt.com
set -e
rm -rf ${WORKING_DIR}
rsync -aqz ${PUBLIC_WWW}/ ${BACKUP_WWW}
trap "echo 'A problem occured. Reverting to backup.'; rsync -aqz --del ${BACKUP_WWW}/ ${PUBLIC_WWW}; rm -rf ${WORKING_DIR}" EXIT
git clone ${GIT_REPO} ${WORKING_DIR}
rm -rf ${PUBLIC_WWW}/*
${HOME}/go/bin/hugo --gc --minify --cleanDestinationDir -s ${WORKING_DIR} -d ${PUBLIC_WWW}
rm -rf ${WORKING_DIR}
trap - EXIT
Loading…
Cancel
Save