Update post-receive git hook

On the new server, `zola` is installed through snap, which means it's
now sandboxed, and doesn't have direct access to the whole filesystem.
This update mostly changes a few bits so that `zola` works only on its
home, and calls `mv` at the end to change the served directory. This
also reduces the time during which the website is destroyed before being
This commit is contained in:
Skia 2024-05-07 17:30:41 +02:00
parent 3bdc33da08
commit b2b7353110

View file

@ -3,19 +3,22 @@
set -e
# Gitea calls us from the repository root
# Ensure this doesn't exist
unset GIT_DIR
TMP_DIR="$(mktemp -d)"
git clone "file://$BASE" --depth 1 "$TMP_DIR"
# Work in a temp dir
TMP_DIR="$(mktemp -d -p "$HOME")"
pushd "$TMP_DIR"
# Build and publish website
git clone "file://$BASE" --depth 1 .
zola build
rm "$OUTPUT_DIR"/* -rf
zola build -o "$OUTPUT_DIR"/zola
mv public "$OUTPUT_DIR"/zola
# Clean up temp dir
rm -rf "$TMP_DIR"
# Finished
exit 0