[infra] Stamp the deploy: curl /gutsy/VERSION to see what is actually live

I shipped a working tree earlier and had to tell John "live matches no commit in
the repo" — which is exactly the sentence a deploy should make impossible.

deploy.sh now writes the HEAD short-sha to web root as VERSION, and verifies it
came back. `curl https://partly.party/gutsy/VERSION` answers "what is online right
now" without trusting anyone's memory of the last deploy.

The dirty check is scoped to `git status --porcelain -- web/`, not the whole
tree, because only web/ ships: editing docs or this script does not make the
payload unreproducible, and a stamp that cried wolf on every NOTES edit would get
ignored. A dirty payload ships as `<sha>-dirty` and says so, loudly, rather than
refusing — mid-round lanes need to push a look at something without committing
first, and a deploy tool that blocks that will just get bypassed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
type-two 2026-07-17 23:04:05 +10:00
parent 31cedb2f60
commit 0e2b5c10fe

View File

@ -43,9 +43,19 @@ bash "$ROOT/tools/qa.sh" > /tmp/gutsy_qa.log 2>&1 || { echo " ✗ QA RED
echo " ✓ QA green" echo " ✓ QA green"
echo "[2/4] Syncing web/ to VPS staging (excluding dev harnesses) ..." echo "[2/4] Syncing web/ to VPS staging (excluding dev harnesses) ..."
COMMIT="$(git -C "$ROOT" rev-parse --short HEAD)"
if [ -n "$(git -C "$ROOT" status --porcelain -- web/)" ]; then
STAMP="$COMMIT-dirty"
echo " ⚠ web/ has uncommitted changes — what ships will match NO commit in the repo"
else
STAMP="$COMMIT"
fi
ssh "$VPS" "rm -rf '$STAGING' && mkdir -p '$STAGING'" ssh "$VPS" "rm -rf '$STAGING' && mkdir -p '$STAGING'"
rsync -az --delete --exclude='.DS_Store' --exclude='dev/' "$ROOT/web/" "$VPS:$STAGING/" rsync -az --delete --exclude='.DS_Store' --exclude='dev/' "$ROOT/web/" "$VPS:$STAGING/"
echo " $(ssh "$VPS" "du -sh $STAGING | cut -f1") staged" # Provenance, curl-able: `curl https://partly.party/gutsy/VERSION` answers "what is actually
# live right now" without trusting anyone's memory of the last deploy.
ssh "$VPS" "printf '%s\n' '$STAMP' > $STAGING/VERSION"
echo " $(ssh "$VPS" "du -sh $STAGING | cut -f1") staged @ $STAMP"
echo "[3/4] Replacing container content ..." echo "[3/4] Replacing container content ..."
ssh "$VPS" "docker exec $CONTAINER sh -c 'rm -rf ${REMOTE_WEB_ROOT:?} && mkdir -p ${REMOTE_WEB_ROOT:?}' && docker cp $STAGING/. $CONTAINER:$REMOTE_WEB_ROOT" ssh "$VPS" "docker exec $CONTAINER sh -c 'rm -rf ${REMOTE_WEB_ROOT:?} && mkdir -p ${REMOTE_WEB_ROOT:?}' && docker cp $STAGING/. $CONTAINER:$REMOTE_WEB_ROOT"
@ -71,6 +81,7 @@ check() { # check <label> <url-suffix> <grep-pattern>
echo "$label" echo "$label"
} }
check "VERSION stamp" "/VERSION" "$STAMP"
check "index.html" "/" 'id="game"' check "index.html" "/" 'id="game"'
check "js/boot.js" "/js/boot.js" 'Lane F' check "js/boot.js" "/js/boot.js" 'Lane F'
check "ui/hud.js" "/js/ui/hud.js" 'createHUD' check "ui/hud.js" "/js/ui/hud.js" 'createHUD'