ci: a merge to main is the public release; every dev push dry-runs it (#8358)
release / web (push) Successful in 1m29s
release / go (push) Successful in 1m54s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 2m44s
release / android (push) Successful in 2m9s
release / Build signed APK (push) Successful in 2m1s
release / Build + push container image (push) Failing after 4s

Every push now builds its image from the git archive export, after the
changelog and the leak gate have run on it, so a dev push is the public
release's dry run. A push to main then also commits and tags the export on
github.com/Fabled-Sword/minstrel as AmateurDungeoneer, publishes
ghcr.io/fabled-sword/minstrel :<name> and :latest, and creates the release
page on GitHub (public changelog) and on this forge (private changelog).

The scripts are Librarian's (ci/changelog.sh, ci/leakgate.sh,
ci/releases.mjs, with their tests), with Minstrel's false positives and a
changelog that ignores the forge-only v* tags from before the public
releases, so the first public release is the fixed note.

The tag build, its APK attach and its verify job, and the manual GHCR
dispatch are gone: phones get the app from the server image, and no
release carries a file. The push trigger has no path filter, because the
README, docs and tests ship in the public release too.

The README's image tags now name what GHCR carries: :latest and :<version>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 20:07:36 -05:00
co-authored by Claude Opus 5.5
parent fde5cbbafd
commit 7ced019c77
11 changed files with 788 additions and 570 deletions
+23 -62
View File
@@ -220,20 +220,18 @@ func releaseYAML(t *testing.T) string {
return string(body)
}
// imageTagArms splits "Compute image tags" into its three ref branches. The
// whole tag policy lives in that if/elif/else, so the arms are the unit worth
// asserting on — a tag published from the wrong arm reaches the wrong
// imageTagArms splits "Compute image tags" into its two ref branches. The
// whole private tag policy lives in that if/else, so the arms are the unit
// worth asserting on — a tag published from the wrong arm reaches the wrong
// audience, and every such mistake still builds and still pushes a valid
// image.
func imageTagArms(t *testing.T, yaml string) (tagArm, devArm, mainArm string) {
func imageTagArms(t *testing.T, yaml string) (devArm, mainArm string) {
t.Helper()
const (
tagMarker = `if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then`
devMarker = `elif [[ "${GITHUB_REF}" == "refs/heads/dev" ]]; then`
devMarker = `if [[ "${GITHUB_REF}" == "refs/heads/dev" ]]; then`
mainMarker = "\n else"
endMarker = "\n fi"
)
iTag := strings.Index(yaml, tagMarker)
iDev := strings.Index(yaml, devMarker)
iMain := -1
if iDev >= 0 {
@@ -241,8 +239,8 @@ func imageTagArms(t *testing.T, yaml string) (tagArm, devArm, mainArm string) {
iMain = iDev + k
}
}
if iTag < 0 || iDev < 0 || iMain < 0 {
t.Fatal("Compute image tags no longer has a tag/dev/main arm — the tag policy has been restructured, so these guards are pinning nothing")
if iDev < 0 || iMain < 0 {
t.Fatal("Compute image tags no longer has a dev/main arm — the tag policy has been restructured, so these guards are pinning nothing")
}
iEnd := iMain
if k := strings.Index(yaml[iMain:], endMarker); k >= 0 {
@@ -250,7 +248,7 @@ func imageTagArms(t *testing.T, yaml string) (tagArm, devArm, mainArm string) {
} else {
t.Fatal("no closing fi after the main arm")
}
return yaml[iTag:iDev], yaml[iDev:iMain], yaml[iMain:iEnd]
return yaml[iDev:iMain], yaml[iMain:iEnd]
}
// The worst regression this wiring can produce: a dev push that also moves
@@ -258,7 +256,7 @@ func imageTagArms(t *testing.T, yaml string) (tagArm, devArm, mainArm string) {
// next pull. Nothing else in the suite would notice — the build stays green
// and the image is valid, it is simply the wrong audience.
func TestDevChannel_PublishesDevAloneAndNeverLatest(t *testing.T) {
_, arm, _ := imageTagArms(t, releaseYAML(t))
arm, _ := imageTagArms(t, releaseYAML(t))
if !strings.Contains(arm, "${IMAGE}:dev") {
t.Errorf("dev arm does not publish :dev\n%s", arm)
@@ -274,14 +272,14 @@ func TestDevChannel_PublishesDevAloneAndNeverLatest(t *testing.T) {
// A merge to main is enough to put a new app in front of stable phones: main
// builds the signed APK from its own commit and bakes it into :latest, as dev
// does for :dev. The regression to guard is main falling back to a tag-only
// APK build, which leaves every merged app change waiting on a release while
// each build stays green.
// does for :dev. The regression to guard is main falling back to an APK built
// somewhere else, which leaves every merged app change waiting while each build
// stays green.
func TestEveryBranchShipsTheAppBuiltFromItsOwnCommit(t *testing.T) {
jobs := releaseJobs(t)
build := strings.Join(strings.Fields(jobs["android-release"].If), " ")
for _, ref := range []string{"refs/heads/main", "refs/heads/dev", "refs/tags/v"} {
for _, ref := range []string{"refs/heads/main", "refs/heads/dev"} {
if !strings.Contains(build, ref) {
t.Errorf("android-release does not build on %s, so that ref's image carries no app of its own\n if: %s", ref, build)
}
@@ -297,8 +295,7 @@ func TestEveryBranchShipsTheAppBuiltFromItsOwnCommit(t *testing.T) {
t.Error("release.yml fetches the latest release; an image bundling a release's APK ships an app older than its own commit")
}
// Both bundling steps run on every ref. Sliced from image-release on,
// because release-assets has a step of the same name.
// Both bundling steps run on every ref.
i := strings.Index(yaml, "\n image-release:")
if i < 0 {
t.Fatal("no image-release job")
@@ -319,7 +316,7 @@ func TestEveryBranchShipsTheAppBuiltFromItsOwnCommit(t *testing.T) {
//
// Rules 145 and 147: main push → :latest + :<sha>.
func TestMainChannel_PublishesLatestAndTheRollbackUnit(t *testing.T) {
_, _, arm := imageTagArms(t, releaseYAML(t))
_, arm := imageTagArms(t, releaseYAML(t))
if !strings.Contains(arm, "${IMAGE}:latest") {
t.Errorf("main arm does not move :latest — production would stop tracking main's tip\n%s", arm)
@@ -334,38 +331,21 @@ func TestMainChannel_PublishesLatestAndTheRollbackUnit(t *testing.T) {
}
}
// A release refreshes the CHANNEL and mints nothing else.
// No version-numbered PRIVATE image tags, on either arm: the build's version
// is self-reported, and the private tag map is :latest, :<sha> and :dev. (The
// public image on GHCR is the one that carries the release's name.)
//
// The regression to guard: a :<sha> tag here. The tag build rebuilds the SAME
// SOURCE as main's build minutes earlier, differing only in which APK is baked
// in — so a :<sha> minted here would overwrite main's immutable rollback
// target with different contents, under the same name.
func TestReleaseBuild_RefreshesTheChannelAndMintsNothingElse(t *testing.T) {
arm, _, _ := imageTagArms(t, releaseYAML(t))
if !strings.Contains(arm, "${IMAGE}:latest") {
t.Errorf("tag arm does not refresh :latest — the server would hand out a different APK build from the one attached to the Release\n%s", arm)
}
if strings.Contains(arm, "GITHUB_SHA") {
t.Errorf("tag arm mints a :<sha> image; that would re-push main's immutable rollback target with different bundled contents\n%s", arm)
}
}
// No version-numbered image tags anywhere, on any arm: the build's version is
// self-reported, and the tag map is :latest, :<sha> and :dev.
//
// Asserted across the whole step rather than per-arm because the mistake this
// catches is re-adding one ANYWHERE, and the tag arm is only the likeliest
// spot. `${VERSION}` still legitimately appears in the step as the build's
// Asserted on both arms because the mistake this catches is re-adding one
// anywhere. `${VERSION}` still legitimately appears in the step as the build's
// self-reported version, so the assertion has to name the image-tag form
// specifically rather than the variable — otherwise it would fire on correct
// code and get "fixed" by deleting the guard.
func TestNoVersionNumberedImageTags(t *testing.T) {
yaml := releaseYAML(t)
tagArm, devArm, mainArm := imageTagArms(t, yaml)
devArm, mainArm := imageTagArms(t, yaml)
for _, tc := range []struct{ name, arm string }{
{"tag", tagArm}, {"dev", devArm}, {"main", mainArm},
{"dev", devArm}, {"main", mainArm},
} {
for _, forbidden := range []string{
"${IMAGE}:${VERSION}",
@@ -380,25 +360,6 @@ func TestNoVersionNumberedImageTags(t *testing.T) {
}
}
// The verify job asserted the :<version> image existed. With version tags
// gone that assertion would fail every release for a tag nothing mints — so
// this pins that it was re-pointed rather than deleted, since deleting it is
// the tempting way to make a failing guard go green.
func TestVerifyJob_ChecksTheRollbackImageNotAVersionTag(t *testing.T) {
yaml := releaseYAML(t)
if !strings.Contains(yaml, "- name: Rollback image must exist for the tagged commit") {
t.Fatal("the release-verification step that checks an image exists is gone; an image push that silently did not happen would now pass verification")
}
step := stepBody(t, yaml, "Rollback image must exist for the tagged commit")
if !strings.Contains(step, "${IMAGE}:${GITHUB_SHA}") {
t.Errorf("the verify step does not inspect the commit's rollback image\n%s", step)
}
if strings.Contains(step, "${IMAGE}:${TAG}") {
t.Errorf("the verify step still inspects a version-numbered image, which is no longer published — this would fail every release\n%s", step)
}
}
// The server's self-reported version is the ONLY thing that identifies a
// build, so a lane that stamps a channel word instead of a version silently
// removes that ability.
@@ -418,7 +379,7 @@ func TestImageBuild_StampsADerivedVersionAndAChannel(t *testing.T) {
// The version must come from the shared derivation, not from the ref.
// Reading it off GITHUB_REF is what produced "main" and "dev" as version
// strings, which is the regression this pins.
_, _, mainArm := imageTagArms(t, yaml)
_, mainArm := imageTagArms(t, yaml)
if strings.Contains(mainArm, `version=main`) {
t.Errorf("the main arm stamps the literal string \"main\" as a version; two images months apart would be indistinguishable\n%s", mainArm)
}