Skip to content

ci(release): tag a release only after every check and test passes - #2382

Merged
houko merged 1 commit into
mainfrom
ci/release-dispatch
Nov 25, 2026
Merged

houko merged 1 commit into
mainfrom
ci/release-dispatch

Conversation

@houko

@houko houko commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Closes #2380.

What changed

  • release.yml gains workflow_dispatch with a required version input (X.Y.Z or X.Y.Z-suffix). Before any test starts, the run refuses a malformed version, a ref other than main, a commit that is no longer main's tip, a tag that already exists locally or on the remote, and a version proxy.golang.org already serves (asked with Disable-Module-Fetch: true, so the question neither fetches the version nor caches its absence).
  • It then runs the existing checks against that commit (changelog section present, no fragments left in changelog.d, Android runtime built from its Java) and calls test.yml with a new all-jobs: true input, which runs the Apple jobs and apple-simulator whatever the event and the change. Pull request and merge queue runs are unchanged.
  • Only after all of that passes, the publish job checks the commit is still on main, asks the proxy once more, creates the annotated tag vX.Y.Z (message NSGo X.Y.Z) on the tested commit through the Git data API, publishes the changelog section as the release (a prerelease for a suffixed version) and announces the version to the proxy, all in the same run, since a ref created with GITHUB_TOKEN starts no workflow. Creating a ref that already exists fails, so an existing tag is never moved. That job is the only one with contents: write.
  • The tag-push trigger still works as before. When a run started by a pushed tag fails, a new burned job writes an error and a step summary saying the version is already public and the next release needs the dispatch.
  • release.yml's header, changelog.d/README.md, AGENTS.md and the contributing guide (every language) describe the new steps.

How to release now

  1. go run ./tools/changelog release X.Y.Z, edit the section, and merge it to main.
  2. gh workflow run release.yml -R nsgo-dev/nsgo --ref main -f version=X.Y.Z (or Actions > Release > Run workflow on main).
  3. Once the run has published the release, remove the section from CHANGELOG.md as before.

Do not push the tag yourself.

Tests

  • actionlint 1.7.12 (the version quality.yml installs) with shellcheck: no findings.
  • go tool nsgo test -run '^TestCheckWorkflowVetsEveryTargetOnce$' ./cmd/nsgo, the repository's workflow test: passes.
  • Checked the version pattern against 0.3.3, 0.3.3-rc.1, v0.3.3, 0.3, 0.3.3;rm and 0.3.3-; git ls-remote --exit-code returning 2 for a missing tag and 0 for v0.3.2; the proxy answering 200 for v0.3.1 and 404 for an untagged version with Disable-Module-Fetch; and the compare API answering identical or ahead for a commit on main.
  • The dispatch path itself runs only on main, so its first real run is the next release.

Screenshots

None.

Run release.yml by hand with a version (gh workflow run release.yml -f version=X.Y.Z) on main's tip. It refuses a malformed version, another ref, a commit main has moved past, an existing tag and a version proxy.golang.org already serves, runs the changelog, fragment and Android runtime checks and every test.yml job through a new all-jobs input, the Apple simulator job included, and only then creates the annotated tag on the tested commit, publishes the notes and announces the version to the proxy in the same run. Only the publishing job can write.

The tag-push trigger keeps working, and a failure on that path now says the version is already public. The release docs in changelog.d, AGENTS.md and the contributing guide describe the new steps.

Closes #2380.
@houko
houko enabled auto-merge (rebase) November 25, 2026 10:23
@github-actions github-actions Bot added size/M documentation Improvements or additions to documentation ci labels Nov 25, 2026
@houko
houko merged commit 8cf0229 into main Nov 25, 2026
29 checks passed
@houko
houko deleted the ci/release-dispatch branch November 25, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci documentation Improvements or additions to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release from a manual run that tags only after every check passes

1 participant