#!/usr/bin/env bash
set -euo pipefail

# Deploy Better Life SG static site to RackNerd.
# The site is served by the shared Caddy stack at /opt/caddy/.

REPO_DIR="${REPO_DIR:-/opt/src/betterlifesg}"
SITE_DIR="${SITE_DIR:-/opt/betterlifesg/site}"

cd "$REPO_DIR"
git pull --ff-only origin master

mkdir -p "$SITE_DIR"
rsync -a --delete site/ "$SITE_DIR/"

echo "Better Life SG site deployed to $SITE_DIR"
