From 301ad44887f55ce76ddc96303b9075a75a6585ac Mon Sep 17 00:00:00 2001 From: Davide Scaini Date: Tue, 2 Jun 2026 15:14:18 +0200 Subject: [PATCH] deploy: add post-receive hook for VPS git-push workflow --- deploy/post-receive | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 deploy/post-receive diff --git a/deploy/post-receive b/deploy/post-receive new file mode 100755 index 0000000..fcb442a --- /dev/null +++ b/deploy/post-receive @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +REPO=/opt/bincio-auth-repo.git +DEPLOY=/opt/bincio-auth + +while read oldrev newrev refname; do + echo "--- Checking out $refname ---" + git --work-tree=$DEPLOY --git-dir=$REPO checkout -f $newrev + + echo "--- Syncing Python deps ---" + cd $DEPLOY + ~/.local/bin/uv sync + + echo "--- Syncing JS deps ---" + cd $DEPLOY/site + npm install --silent + + echo "--- Building site (bincio.org) ---" + PUBLIC_ACTIVITY_URL=https://activity.bincio.org \ + PUBLIC_WIKI_URL=https://wiki.bincio.org \ + PUBLIC_PLANNER_URL=https://planner.bincio.org \ + npm run build + + rsync -a --delete $DEPLOY/site/dist/ /var/www/bincio/ + + echo "--- Restarting bincio-auth ---" + systemctl restart bincio-auth || echo "WARNING: bincio-auth restart failed" + + echo "--- Done ---" +done