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 replaced.
This commit is contained in:
parent
3bdc33da08
commit
b2b7353110
|
@ -3,19 +3,22 @@
|
|||
set -e
|
||||
|
||||
OUTPUT_DIR="/storage/www/hya.sk/website/"
|
||||
|
||||
# Gitea calls us from the repository root
|
||||
BASE="$(pwd)"
|
||||
|
||||
# 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
|
||||
popd
|
||||
rm -rf "$TMP_DIR"
|
||||
|
||||
# Finished
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue