Skip to content

feat: Tiger Studio Web hotfixes — npm run web:hotfix tags web-vX.Y.Z.… #2

feat: Tiger Studio Web hotfixes — npm run web:hotfix tags web-vX.Y.Z.…

feat: Tiger Studio Web hotfixes — npm run web:hotfix tags web-vX.Y.Z.… #2

Workflow file for this run

name: Web sync
# Tiger Studio Web (studio.tigersystem.io) and the desktop app must ALWAYS be on
# the same version. Both follow the published "latest" GitHub Release: the
# desktop auto-updater installs it, and the Hub builds it into /studio on every
# deploy (TigerTag_Hub → scripts/fetch-studio-web.mjs).
#
# Two triggers, one job — deploy the Hub, then wait until the live site serves
# exactly the expected build, and fail loudly if it doesn't (a red run here means
# desktop and web are out of sync):
# • a release is PUBLISHED (drafts don't count — that is when desktops start
# updating) → expect "X.Y.Z", web build 0;
# • a web hotfix tag `web-vX.Y.Z.N` is pushed (docs/WEB_HOTFIX.md) → expect
# "X.Y.Z · web N", with no desktop build at all. X.Y.Z must be the latest
# release, or the tag is refused.
#
# Secret: HUB_DEPLOY_HOOK_URL — the Vercel deploy hook "studio-release" of the
# tiger-tag-hub project (Settings → Git → Deploy Hooks, branch main).
on:
release:
types: [published]
push:
tags:
- 'web-v*'
workflow_dispatch:
jobs:
deploy-web:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Work out the expected web version
id: want
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
REF_NAME: ${{ github.ref_name }}
EVENT: ${{ github.event_name }}
run: |
latest=$(curl -fsSI "https://github.com/${{ github.repository }}/releases/latest" \
| tr -d '\r' | sed -n 's#^[Ll]ocation: .*/releases/tag/v##p')
if [ "$EVENT" = "push" ]; then
base="${REF_NAME#web-v}"; build="${base##*.}"; base="${base%.*}"
if [ "$base" != "$latest" ]; then
echo "::error::$REF_NAME is a hotfix of $base, but the latest release is $latest — the Hub would ignore it"
exit 1
fi
elif [ "$EVENT" = "release" ]; then
base="${RELEASE_TAG#v}"; build=0
else # manual run: whatever the Hub should currently serve
base="$latest"; build=""
fi
echo "version=$base" >> "$GITHUB_OUTPUT"
echo "build=$build" >> "$GITHUB_OUTPUT"
echo "Expecting $base${build:+ · web $build}"
- name: Trigger the Hub deploy
env:
HOOK: ${{ secrets.HUB_DEPLOY_HOOK_URL }}
run: |
test -n "$HOOK" || { echo "::error::HUB_DEPLOY_HOOK_URL secret is missing"; exit 1; }
curl -fsS -X POST "$HOOK" > /dev/null
echo "Hub deploy triggered"
- name: Wait until studio.tigersystem.io serves it
env:
WANT_VERSION: ${{ steps.want.outputs.version }}
WANT_BUILD: ${{ steps.want.outputs.build }}
run: |
for i in $(seq 1 60); do
json=$(curl -fsS "https://studio.tigersystem.io/studio/version.json?t=$(date +%s)" 2>/dev/null || true)
live=$(echo "$json" | sed -n 's/.*"version": *"\([^"]*\)".*/\1/p')
lb=$(echo "$json" | sed -n 's/.*"webBuild": *\([0-9]*\).*/\1/p'); lb=${lb:-0}
echo "live=${live:-none} · web ${lb} want=$WANT_VERSION${WANT_BUILD:+ · web $WANT_BUILD}"
if [ "$live" = "$WANT_VERSION" ] && { [ -z "$WANT_BUILD" ] || [ "$lb" = "$WANT_BUILD" ]; }; then
echo "Web is on $live${WANT_BUILD:+ · web $WANT_BUILD}, desktop on $WANT_VERSION"; exit 0
fi
sleep 20
done
echo "::error::studio.tigersystem.io serves ${live:-nothing} · web ${lb}, expected $WANT_VERSION${WANT_BUILD:+ · web $WANT_BUILD} — web and desktop are out of sync"
exit 1