This commit is contained in:
Stanislav Hubacek
2026-04-07 20:16:22 +02:00
parent a133a8d41c
commit a75d9b4d34
3 changed files with 129 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_DIR="/opt/homelab"
BRANCH="main"
echo "[1/4] Switching to repo..."
cd "$REPO_DIR"
echo "[2/4] Fetching changes..."
git fetch origin "$BRANCH"
LOCAL="$(git rev-parse HEAD)"
REMOTE="$(git rev-parse origin/$BRANCH)"
if [[ "$LOCAL" == "$REMOTE" ]]; then
echo "[3/4] No changes to deploy."
exit 0
fi
echo "[3/4] Pulling latest changes..."
git pull --ff-only origin "$BRANCH"
echo "[4/4] Running Caddy deployment..."
"$REPO_DIR/scripts/deploy_caddy.sh"
echo "[Done] Git-based deployment completed."