feat: add deployment automation scripts

This commit is contained in:
2025-12-27 15:42:26 +11:00
parent 87f1711cbd
commit 33b2b708f4
9 changed files with 951 additions and 0 deletions

26
sync-and-restart.sh Normal file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Ensure we are in the project directory
cd "$(dirname "$0")"
# Fetch the latest changes from the remote
git remote update
# Check if local is behind remote (UPSTREAM)
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date"
elif [ $LOCAL = $BASE ]; then
echo "Need to pull"
git pull
# Only run deploy/restart if we actually pulled changes
./deploy.sh
elif [ $REMOTE = $BASE ]; then
echo "Need to push"
else
echo "Diverged"
fi