You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
607 B
20 lines
607 B
2 years ago
|
#!/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
|