gethumanai-landing/deploy.sh

40 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Host: SATURN
# Run this script from SATURN to commit, push and deploy to VPS.
VPS="ubuntu-4gb-hel1-1"
REPO_DIR="/home/oskar/projects/gethumanai-landing"
VPS_DEPLOY_DIR="/home/oskar/gethumanai-landing"
FORGEJO_REMOTE="ssh://git@100.108.208.3:222/oskar/gethumanai-landing.git"
# ── 1. Commit & push (SATURN) ──────────────────────────────────────────────
# Host: SATURN
cd "$REPO_DIR"
if [ -n "$(git status --porcelain)" ]; then
git add -A
git commit -m "chore: deploy $(date '+%Y-%m-%d %H:%M')"
fi
git push origin main
# ── 2. Pull & rebuild on VPS ───────────────────────────────────────────────
# Host: ubuntu-4gb-hel1-1
ssh "$VPS" bash -s <<'REMOTE'
set -euo pipefail
DEPLOY_DIR="/home/oskar/gethumanai-landing"
if [ ! -d "$DEPLOY_DIR/.git" ]; then
git clone ssh://git@100.108.208.3:222/oskar/gethumanai-landing.git "$DEPLOY_DIR"
fi
cd "$DEPLOY_DIR"
git pull origin main
docker compose up -d --build --remove-orphans
echo "Deploy complete."
REMOTE
echo "Done — humanAI landing is live."