Submatter/scripts/git-sync-deploy.sh
Randall Stillwell 9bde5960bf
Some checks failed
CI / Lint, type-check, test (push) Has been cancelled
Deploy homelab (CT 116) / Deploy to CT 116 (push) Has been cancelled
fix(deploy): collab URL, CT 116 prod compose, Forgejo migration
- Read NEXT_PUBLIC_COLLAB_SERVER_URL in yjs provider; bake NEXT_PUBLIC_* at Docker build
- Add prod compose, deploy scripts, CT 116 proxmox scaffolding
- Forgejo Actions CI/deploy; migrate-origin and post-migration scripts
2026-09-08 22:33:59 -05:00

20 lines
630 B
Bash
Executable file

#!/usr/bin/env bash
# Sync production checkout to the deploy branch tip (used by deploy webhook + CI over SSH).
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
branch="${DEPLOY_BRANCH:-main}"
remote="${DEPLOY_GIT_REMOTE:-origin}"
if [[ ! -d .git ]]; then
echo "[git-sync-deploy] ERROR: ${repo_root} is not a git repository" >&2
exit 1
fi
echo "[git-sync-deploy] fetching ${remote}/${branch}..."
git fetch "$remote" "$branch"
git checkout "$branch"
git reset --hard "${remote}/${branch}"
echo "[git-sync-deploy] at $(git rev-parse --short HEAD) ($(git log -1 --format='%s'))"