From fc9d8702fe26929b1052b89eb2c7f44b7060df4e Mon Sep 17 00:00:00 2001 From: soul Date: Wed, 25 Nov 2026 20:41:04 +0100 Subject: [PATCH] Release workflow: preflight host prerequisites, atomic push, pinned Git Bash; checklist recovery and exec bits; define player-visible Co-Authored-By: Claude Sonnet 5.5 --- .forgejo/workflows/release.yml | 30 +++++++++++++++++++++++------- CLAUDE.md | 1 + docs/release-checklist.md | 22 ++++++++++++++++------ 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 363229f07..61fee25e1 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -1,8 +1,8 @@ # The one actor that turns .changeset/ files and VERSION into a tag and a forge release (docs/release-checklist.md). # Dispatch by hand on the branch to release. Runs on the Starfire runner in host mode, as the operator's Windows user, -# because the Unity Personal licence lives there. Needs repo secret RELEASE_TOKEN (write:repository), repo variable -# UNITY_EDITOR (path to Unity.exe 6000.3.24f1) and knope on PATH; CULTLIB_ROOT and CULTMATH_ROOT variables are optional. -# Nothing is pushed until both players have built: a failed build leaves the forge untouched. +# because the Unity Personal licence lives there. Every host prerequisite is checked by the first step, before any build or +# push (list: docs/release-checklist.md, One-time setup). Nothing is pushed until both players have built: a failed +# preflight or build leaves the forge untouched. After the push, a failed forge release has a recovery in the checklist. name: release on: @@ -22,8 +22,25 @@ jobs: BUILD_NAME: release-${{ github.run_id }} defaults: run: - shell: bash + shell: 'C:\Program Files\Git\bin\bash.exe -e {0}' steps: + - name: Preflight host prerequisites + env: + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + set -u + missing="" + note() { missing="$missing"$'\n'" $1"; } + for tool in jq curl knope git tar dotnet; do + command -v "$tool" >/dev/null || note "$tool is not on PATH" + done + test -x /c/Windows/System32/tar.exe || note "C:/Windows/System32/tar.exe is missing" + test -n "$RELEASE_TOKEN" || note "secret RELEASE_TOKEN is not set" + test -f "$UNITY_EDITOR" || note "repo variable UNITY_EDITOR is unset or not a file: '$UNITY_EDITOR'" + test -d "$CULTLIB_ROOT" || note "repo variable CULTLIB_ROOT is unset or not a directory: '$CULTLIB_ROOT'" + test -d "$CULTMATH_ROOT" || note "repo variable CULTMATH_ROOT is unset or not a directory: '$CULTMATH_ROOT'" + if test -n "$missing"; then echo "release preflight failed, nothing was built or pushed:$missing"; exit 1; fi + - uses: actions/checkout@v4 with: lfs: true @@ -34,7 +51,6 @@ jobs: id: prepare run: | set -euo pipefail - test -n "$UNITY_EDITOR" || { echo "repo variable UNITY_EDITOR is not set"; exit 1; } knope prepare-release version="$(tr -d '\r\n' < VERSION)" if git rev-parse -q --verify "refs/tags/v$version" >/dev/null; then @@ -69,7 +85,7 @@ jobs: - name: Publish tag and release commit run: | set -euo pipefail - git push origin "HEAD:refs/heads/${{ github.ref_name }}" "refs/tags/v${{ steps.prepare.outputs.version }}" + git push --atomic origin "HEAD:refs/heads/${{ github.ref_name }}" "refs/tags/v${{ steps.prepare.outputs.version }}" - name: Forge release uses: actions/forgejo-release@v2.13.4 @@ -87,5 +103,5 @@ jobs: run: tail -n 40 ../"$BUILD_NAME"/*.log || true - name: Remove build directory - if: always() + if: success() run: rm -rf ../"$BUILD_NAME" diff --git a/CLAUDE.md b/CLAUDE.md index 17404c872..2ed5ea4a4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -22,4 +22,5 @@ ## Releases +- Player-visible means a player of the shipped game could notice it, or a modder using the shipped ModTools could. Needs a change file: gameplay or balance changes, new or changed content, UI or controls, fixes to bugs a player could hit, modding format changes. Needs none: tests, refactors, docs, editor-only tools, build and CI changes, internal data layout that players and modders never see. - A player-visible change lands with a `.changeset/` file (bump level and one player-facing line), written by whoever lands it, agents included. Change files decide the release's version bump and changelog; `docs/release-checklist.md` has the format. diff --git a/docs/release-checklist.md b/docs/release-checklist.md index 995e17280..a916baa4c 100644 --- a/docs/release-checklist.md +++ b/docs/release-checklist.md @@ -15,16 +15,26 @@ nothing. A published version is never edited; a mistake is a new version. 1. Check the change files on the branch read as the changelog you want. 2. Dispatch the `release` workflow on that branch (Actions tab). It runs on Starfire, one job at a time. It prepares the - release, builds win64 then linux64, and only then pushes the `Release X.Y.Z` commit and tag `vX.Y.Z` and publishes. + release, builds win64 then linux64, and only then pushes the `Release X.Y.Z` commit and tag `vX.Y.Z` (one atomic push) + and publishes. The first step checks every host prerequisite and fails before any build or push. The first release this + pipeline makes is v0.2.1. 3. Check the forge release: the notes match the CHANGELOG section, and `Aetheria-X.Y.Z-win64.zip` and `-linux64.zip` are - attached. Unpack both and launch. The zips are made on Windows, so on Linux run `chmod +x Aetheria.x86_64` first. -4. Mirroring to GitHub is by hand if wanted; there is no GitHub automation. + attached. Unpack both and launch. The zips are made on Windows and lose the exec bit, so on Linux run + `chmod +x Aetheria.x86_64 ModTools/AetherDb` first (those are the only executables in the linux64 player). +4. If the run fails after the push (the forge release step), the commit and tag are already on the forge and the build + directory `../release-` is kept on Starfire. Do not rerun: the tag exists and the change files are consumed. + Create the release by hand on tag `vX.Y.Z`, paste the CHANGELOG section as notes, attach the two zips from that + directory's `dist/`, then delete the directory. A failure before the push needs only a rerun (delete the leftover build + directory). +5. Mirroring to GitHub is by hand if wanted; there is no GitHub automation. ## One-time setup (operator acts) - Register the runner on Starfire with label `starfire` in host mode, capacity 1, running as the operator's Windows user - (follow-up `starfire-forge-runner`); install knope on that user's PATH. -- Repo secret `RELEASE_TOKEN` (write:repository); repo variable `UNITY_EDITOR` (Unity.exe, 6000.3.24f1); optional variables - `CULTLIB_ROOT` and `CULTMATH_ROOT` when the default CultLib checkouts do not hold the pinned revisions. + (follow-up `starfire-forge-runner`). Runner prerequisites, all checked by the workflow's preflight: Git for Windows at + `C:\Program Files\Git` (the workflow pins its `bash.exe`), and on PATH `knope`, `jq` and `curl` (both needed by the forge + release action), `git`, `dotnet` (publishes AetherDb) and `tar`; `C:\Windows\System32 ar.exe` makes the zips. +- Repo secret `RELEASE_TOKEN` (write:repository); repo variables `UNITY_EDITOR` (Unity.exe, 6000.3.24f1), and `CULTLIB_ROOT` + and `CULTMATH_ROOT` (checkouts holding the pinned CultLib and CultMath revisions). All are required. - Ruling `sbsar-lfs-objects`: prune the 41 `.sbsar` LFS objects from Forgejo's LFS store and the Raven LFS mirror. Git history keeps its pointers. This is an operator act, not the workflow's.