refactor!: retire wails.json, config.yml is the version source

- version.go (generated, never hand-edited) carries the compiled-in
  version; app.go drops the wails.json embed plus the gjson dependency
- make release bumps config.yml and regenerates version.go in one
  commit; the re-run-safe guards from the 1.99.1 cycle carry over
- release guard reads config.yml; CI CLI pin and cache key move to
  beta.22 to match the lockstep above
- release wrapper and config NOTE comments updated; deletion proof:
  wails3 build green plus a dev boot reaching the connected state
  with the file absent (the one cold-boot failure reproduced as a
  Vite 8 cold-start vs app retry race, cleared by rerunning warm)
This commit is contained in:
John O'Keefe
2026-09-16 16:29:35 -04:00
parent de808dbb67
commit 2a6397b964
6 changed files with 38 additions and 34 deletions
+14 -13
View File
@@ -12,9 +12,10 @@ run-name: "Release ${{ gitea.event.inputs.tag || gitea.ref_name }}"
# work-in-progress commits never ship.
#
# Local flow: `./release 1.6.7` (or `make release VERSION=1.6.7`) bumps
# wails.json, commits the bump, creates an annotated tag carrying the
# git-cliff notes, and pushes commit + tag. This workflow verifies
# wails.json matches the tag before building.
# build/config.yml (and the generated version.go), commits the bump,
# creates an annotated tag carrying the git-cliff notes, and pushes
# commit + tag. This workflow verifies build/config.yml matches the tag
# before building.
#
# Secrets test (verifies environment.go wiring without shipping): tag the
# current bumped commit with a suffix and push, e.g.
@@ -49,7 +50,7 @@ jobs:
fetch-depth: 0
ref: ${{ gitea.event.inputs.tag || gitea.ref }}
- name: Guard wails.json matches tag
- name: Guard build/config.yml matches tag
run: |
set -euo pipefail
: "${TAG:?TAG is required}"
@@ -58,21 +59,21 @@ jobs:
NORM="${TAG#v}"
NORM="${NORM#AniTrack-}"
BASE="${NORM%%-*}"
WAILS_VER="$(python3 -c "import json; print(json.load(open('wails.json'))['info']['productVersion'])")"
CFG_VER="$(python3 -c "import re; print(re.search(r'^ version: \"([^\"]*)\"', open('build/config.yml').read(), flags=re.M).group(1))")"
if [ "${NORM}" = "${BASE}" ]; then
if [ "${WAILS_VER}" != "${NORM}" ]; then
echo "::error::wails.json productVersion (${WAILS_VER}) != tag (${NORM}). Bump via ./release ${NORM} first." >&2
if [ "${CFG_VER}" != "${NORM}" ]; then
echo "::error::build/config.yml info.version (${CFG_VER}) != tag (${NORM}). Bump via ./release ${NORM} first." >&2
exit 1
fi
else
# Pre-release (e.g. 1.6.7-rc1): wails.json must match the base version.
if [ "${WAILS_VER}" != "${BASE}" ]; then
echo "::error::wails.json productVersion (${WAILS_VER}) != tag base (${BASE}). Bump via ./release ${BASE} first." >&2
# Pre-release (e.g. 1.6.7-rc1): build/config.yml must match the base version.
if [ "${CFG_VER}" != "${BASE}" ]; then
echo "::error::build/config.yml info.version (${CFG_VER}) != tag base (${BASE}). Bump via ./release ${BASE} first." >&2
exit 1
fi
fi
echo "VERSION=${NORM}" >> "${GITHUB_ENV}"
echo "Version guard passed: wails.json=${WAILS_VER} tag=${NORM}"
echo "Version guard passed: build/config.yml=${CFG_VER} tag=${NORM}"
- name: Set up Go
uses: actions/setup-go@v5
@@ -119,13 +120,13 @@ jobs:
# The compiled CLI binary. Bump the key whenever the @version pin
# below changes, or the old CLI will be silently reused.
path: ~/go/bin/wails3
key: wails3-v3.0.0-beta.20-${{ runner.os }}
key: wails3-v3.0.0-beta.22-${{ runner.os }}
- name: Install Wails CLI
if: steps.wails-cli.outputs.cache-hit != 'true'
run: |
set -euo pipefail
go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0-beta.20
go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0-beta.22
- name: Add Go bin to PATH
run: echo "${HOME}/go/bin" >> "${GITHUB_PATH}"
+13 -12
View File
@@ -11,22 +11,26 @@ build:
clean:
rm -rf build/bin/*
# Create a version commit (wails.json bump, committed and pushed) plus an
# Create a version commit (version bump, committed and pushed) plus an
# annotated version tag carrying auto-generated release notes (git-cliff),
# and push both. The tag push triggers .gitea/workflows/release.yml, which
# verifies wails.json matches the tag, builds via `make build`, packages
# verifies build/config.yml matches the tag, builds via `make build`, packages
# AniTrack-<VERSION>.tar.gz from build/, and publishes a Gitea Release
# named AniTrack-<VERSION> with the archive attached. Notes come entirely
# from Conventional Commits — no hand-written message required.
#
# The single version source is build/config.yml info.version. `make release`
# bumps it and regenerates version.go (the compiled-in copy) from it, so the
# two can never drift; both ride the same bump commit.
#
# git-cliff's --latest needs the tag to exist to scope the notes, so we
# create a throwaway lightweight tag, generate the notes, replace it with
# an annotated tag, then push. --cleanup=verbatim keeps the markdown "###"
# group headers (git's default cleanup would strip lines starting with "#").
#
# Tags are plain versions (1.6.7) to match wails.json productVersion and the
# existing tag history. Pre-releases are created by tagging manually with a
# suffix (e.g. 1.6.7-rc1 on top of the bumped commit) — the workflow marks
# Tags are plain versions (1.6.7) to match build/config.yml info.version and
# the existing tag history. Pre-releases are created by tagging manually with
# a suffix (e.g. 1.6.7-rc1 on top of the bumped commit) — the workflow marks
# those as prerelease. Use ./release as a shortcut.
#
# Requires git-cliff: https://git-cliff.org/install
@@ -35,17 +39,14 @@ release:
@test -n "$(VERSION)" || { echo "Usage: make release VERSION=1.6.7"; exit 1; }
@echo "$(VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$' || { echo "VERSION must be plain semver like 1.6.7 (no v prefix, no AniTrack- prefix, no suffix)"; exit 1; }
@command -v git-cliff >/dev/null 2>&1 || { echo "git-cliff not found — install: https://git-cliff.org/install"; exit 1; }
@command -v python3 >/dev/null 2>&1 || { echo "python3 not found — required to bump wails.json"; exit 1; }
@command -v python3 >/dev/null 2>&1 || { echo "python3 not found — required to bump versions"; exit 1; }
@git diff --quiet && git diff --cached --quiet || { echo "Working tree dirty — commit or stash first"; exit 1; }
@if git rev-parse "$(VERSION)" >/dev/null 2>&1; then echo "Tag $(VERSION) already exists locally — delete it first: git tag -d $(VERSION)"; exit 1; fi
@echo "Bumping wails.json to $(VERSION)..."
@python3 -c "import json; p='wails.json'; d=json.load(open(p)); d['info']['productVersion']='$(VERSION)'; json.dump(d, open(p,'w'), indent=2); open(p,'a').write('\n')"
# TEMP until wails.json (v2 leftover) is retired: bump build/config.yml too.
# The regex targets only the indented info.version line, never the
# top-level schema `version: '3'`.
@echo "Bumping build/config.yml to $(VERSION)..."
@python3 -c "import re; p='build/config.yml'; s=open(p).read(); m=re.search(r'^ version: \"([^\"]*)\"', s, flags=re.M); assert m, 'info.version not found'; print('build/config.yml', m.group(1), '-> $(VERSION)' if m.group(1) != '$(VERSION)' else '(already at version)'); open(p,'w').write(re.sub(r'^ version: \"[^\"]*\"', ' version: \"$(VERSION)\"', s, count=1, flags=re.M))"
@git add wails.json build/config.yml
@echo "Regenerating version.go from build/config.yml..."
@python3 -c "import re; v=re.search(r'^ version: \"([^\"]*)\"', open('build/config.yml').read(), flags=re.M).group(1); open('version.go','w').write('package main\n\n// Code generated by \`make release\` from build/config.yml info.version.\n// DO NOT EDIT.\nconst appVersionString = \"%s\"\n' % v)"
@git add build/config.yml version.go
@git diff --cached --quiet && echo "versions already at $(VERSION), skipping bump commit" || git commit -m "chore(release): bump version to $(VERSION)"
@echo "Generating release notes for $(VERSION)..."
@git tag "$(VERSION)" HEAD && \
+3 -7
View File
@@ -1,16 +1,11 @@
package main
import (
_ "embed"
"strings"
"github.com/tidwall/gjson"
"github.com/wailsapp/wails/v3/pkg/application"
)
//go:embed wails.json
var wailsJSON string
// App struct
type App struct {
app *application.App
@@ -21,9 +16,10 @@ func NewApp(app *application.App) *App {
return &App{app: app}
}
// appVersion reads the product version from wails.json.
// appVersion is the release version, stamped into version.go by
// `make release` from build/config.yml.
func appVersion() string {
return gjson.Get(wailsJSON, "info.productVersion").String()
return appVersionString
}
// appTitle is the window title: "AniTrack <version>".
+2 -1
View File
@@ -1,5 +1,6 @@
# Wails v3 project configuration.
# NOTE: `make release` bumps `info.version` below alongside wails.json.
# NOTE: `info.version` below is the single version source: `make release`
# bumps it and regenerates version.go (the compiled-in copy) from it.
# Never touch the top-level `version: '3'` — that is the config file schema,
# not the app version.
version: '3'
+1 -1
View File
@@ -4,7 +4,7 @@
# instead of:
# make release VERSION=1.6.7
# Lives in the repo (no machine-specific alias needed). Tags are plain
# versions (1.6.7) to match wails.json productVersion.
# versions (1.6.7) to match build/config.yml info.version.
set -eu
[ "$#" -ge 1 ] || { echo "Usage: ./release 1.6.7" >&2; exit 1; }
+5
View File
@@ -0,0 +1,5 @@
package main
// Code generated by `make release` from build/config.yml info.version.
// DO NOT EDIT.
const appVersionString = "1.99.1"