Files
wadamesh/scripts/deploy-site.sh
T
Kaj SchittecatandClaude Opus 5.5 5db1c7b761 site: the changelog lists only tagged betas
deploy-site.sh rebuilds changelog.html from every release-notes/beta_N.txt,
so draft notes for a build not cut yet went live with an unrelated site
deploy. A note is now listed only once its beta_N tag exists, and the deploy
fetches tags first so a tag made by gh release create is seen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:48:53 +01:00

47 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# wadamesh site deploy: publish the static landing page (deploy/site/) to the
# VPS web root behind Cloudflare.
#
# The apex `wadamesh.com` nginx block serves /srv/wadamesh/site
# (flasher.wadamesh.com 301-redirects there), so that dir IS the live site.
#
# Usage:
# WADAMESH_VPS=user@your-vps scripts/deploy-site.sh # deploy
# WADAMESH_VPS=user@your-vps scripts/deploy-site.sh --dry-run # preview only
#
# Optional:
# WADAMESH_SITE_PATH=/srv/wadamesh/site # override the web root
#
# The VPS target comes from the environment — never commit it (Cloudflare fronts
# the origin, so the IP isn't needed in the repo).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
SRC="$ROOT/deploy/site/"
DEST="${WADAMESH_VPS:?set WADAMESH_VPS=user@host}"
DEST_PATH="${WADAMESH_SITE_PATH:-/srv/wadamesh/site}"
DRY=""
[ "${1:-}" = "--dry-run" ] && DRY="--dry-run"
# The changelog page (what the firmware's text browser opens when there is no home page on
# the SD card, #622) is generated from release-notes/ so it always matches the builds.
git -C "$ROOT" fetch -q --tags origin 2>/dev/null || true # a release tag made on GitHub (gh release create) must be known here
python3 "$ROOT/scripts/build/gen-changelog.py"
# The app store page lists the Store catalog (deploy/apps/apps.json) with the write-ups in
# deploy/site/apps-info.json, so a new app version shows up there at the next site deploy.
python3 "$ROOT/scripts/build/gen-apps-page.py"
# Mirror deploy/site/ -> web root. --delete prunes files no longer in the repo;
# everything under deploy/site/ is static (html, svg, json manifests).
# Note: -a preserves source perms (644 files / 755 dirs) — no --chmod, since the
# rsync that ships with macOS rejects the D755,F644 per-type syntax.
rsync -avz $DRY --delete "$SRC" "$DEST:$DEST_PATH/"
if [ -z "$DRY" ]; then
echo
echo "deployed deploy/site/ -> $DEST:$DEST_PATH"
echo "note: Cloudflare edge-caches; HTML is short-TTL but purge the zone if a"
echo " change doesn't show within a minute."
fi