diff --git a/scripts/deploy_from_git.sh b/scripts/deploy_from_git.sh index 48cc24b..e5a0fe3 100755 --- a/scripts/deploy_from_git.sh +++ b/scripts/deploy_from_git.sh @@ -2,26 +2,20 @@ set -euo pipefail REPO_DIR="/opt/homelab" -BRANCH="main" -#note -echo "[1/4] Switching to repo..." + +echo "[1/5] Switching to repo..." cd "$REPO_DIR" -echo "[2/4] Fetching changes..." -git fetch origin "$BRANCH" +echo "[2/5] Fetching changes..." +git fetch origin -LOCAL="$(git rev-parse HEAD)" -REMOTE="$(git rev-parse origin/$BRANCH)" +echo "[3/5] Resetting to origin/main..." +git reset --hard origin/main -if [[ "$LOCAL" == "$REMOTE" ]]; then - echo "[3/4] No changes to deploy." - exit 0 -fi +echo "[4/5] Cleaning untracked files..." +git clean -fd -echo "[3/4] Pulling latest changes..." -git pull --ff-only origin "$BRANCH" +echo "[5/5] Running deploy..." +./scripts/deploy_caddy.sh -echo "[4/4] Running Caddy deployment..." -"$REPO_DIR/scripts/deploy_caddy.sh" - -echo "[Done] Git-based deployment completed." +echo "[Done]" \ No newline at end of file