Update post-receive hook to use make for ahead of time compression
This commit is contained in:
parent
763c2e2343
commit
cc785e8c61
12
hooks/post-receive
Normal file → Executable file
12
hooks/post-receive
Normal file → Executable file
@ -9,14 +9,22 @@ MY_DOMAIN=www.vbrandl.net
|
||||
|
||||
set -e
|
||||
|
||||
echo Deleting old working directory...
|
||||
rm -rf $WORKING_DIRECTORY
|
||||
echo Creating backup...
|
||||
rsync -aqz ${PUBLIC_WWW}/ $BACKUP_WWW
|
||||
trap "echo 'A problem occurred. Reverting to backup.'; rsync -aqz --del $BACKUP_WWW/ $PUBLIC_WWW; rm -rf $WORKING_DIRECTORY" EXIT
|
||||
trap "echo 'A problem occurred. Reverting to backup.'; rsync -aqz --del $BACKUP_WWW/ $PUBLIC_WWW; rm -rf
|
||||
$WORKING_DIRECTORY" EXIT
|
||||
|
||||
echo Cloning into working directory...
|
||||
git clone --recursive $GIT_REPO $WORKING_DIRECTORY
|
||||
echo Deleting old version...
|
||||
rm -rf $PUBLIC_WWW/*
|
||||
echo Generating HTML...
|
||||
$HOME/.local/bin/hugo -s $WORKING_DIRECTORY -d ${PUBLIC_WWW} -b "https://${MY_DOMAIN}"
|
||||
# ahead of time compression
|
||||
find $PUBLIC_WWW -type f \( -name '*.html' -o -name '*.js' -o -name '*.css' -o -name '*.xml' -o -name '*.svg' \) -exec gzip -v -k -f --best {} \; -exec touch -r {} "{}.gz" \;
|
||||
echo Compressing files ahead of time...
|
||||
make -C $PUBLIC_WWW -f $WORKING_DIRECTORY/Makefile
|
||||
echo Deleting working directory...
|
||||
rm -rf $WORKING_DIRECTORY
|
||||
trap - EXIT
|
||||
|
Loading…
Reference in New Issue
Block a user