Something went wrong. Try again.
A video game where you play as a misaligned AI, deceiving and building power. cameron.tngl.io/misaligned
Something went wrong. Try again.
1.3 kB · 28 lines
Shell
at main
1234567891011121314151617181920212223242526272829#!/usr/bin/env bash# Manual fallback. CI publishes every push to main (.tangled/workflows/ci.yml),# so normally you only push and then run tools/live.sh.## This builds the tip of main and publishes it to the `pages` branch. It refuses# unless HEAD is exactly origin/main, so a stale checkout cannot roll the site# back, and tools/publish-pages.sh checks again right before pushing.set -euo pipefailROOT="$(cd "$(dirname "$0")/.." && pwd)"cd "$ROOT"[ -z "$(git status --porcelain --untracked-files=no)" ] || { echo "deploy: commit your changes first" >&2; exit 1; }git fetch -q origin mainREV="$(git rev-parse HEAD)"MAIN="$(git rev-parse origin/main)"if [ "$REV" != "$MAIN" ]; then if git merge-base --is-ancestor "$REV" "$MAIN"; then echo "deploy: refusing. HEAD ${REV:0:12} is behind origin/main ${MAIN:0:12}; publishing it would roll the site back. Rebase first." >&2 else echo "deploy: refusing. HEAD ${REV:0:12} is not origin/main ${MAIN:0:12}; push it to main first (CI then deploys it)." >&2 fi exit 1fi
npm run ci # type-check, test, buildbash tools/publish-pages.sh "$REV" dist || { s=$?; [ "$s" -eq 2 ] && echo "deploy: main moved on while building; not publishing an old build. Rebase and run again, or let CI publish the new tip" >&2; exit "$s"}exec bash tools/live.sh "$REV"