Repository navigation
ci(release): automate release tagging - #27
Merged
Merged
Conversation
Every push to main reads the package.json version through the API and, if v<version> is not tagged yet, runs quality and build against the merge commit, then creates the annotated tag and dispatches release.yml at it. The dispatched run publishes, so provenance still records the tag. Ported from noppu-labs/opencode-permission-reviewer#117.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Ported from noppu-labs/opencode-permission-reviewer#117.
What changes
Every push to
mainnow runsrelease.yml:pending(read-only, no checkout) reads thepackage.jsonversion through the API, rejects anything that isn't semver, and stops ifv<version>already exists. Pushes that don't bump the version release nothing.qualityandbuildrun against the merge commit as a pre-check. Their tag gate is replaced on this event by: HEAD isGITHUB_SHA, HEAD descends fromorigin/main, the tag doesn't exist yet, and it equalsv+ thepackage.jsonversion.tag(contents: write,actions: write, no checkout) creates the annotated tag through the REST API and runsgh workflow run release.yml --ref v<version> -f tag=v<version>.GITHUB_TOKENdispatch starts a new run (aGITHUB_TOKENtag push wouldn't). Because the run's ref is the tag, npm provenance and attestations still recordrefs/tags/v<version>.publishnever runs on the push tomain. If the pre-check fails, no tag is created: fix it in another PR and merge again with the same version. Hand-pushedv*tags and dispatch retries work as before.Also included:
tests/release-workflow.test.ts: structural checks on triggers, permissions and gating, plus a guard that no job with write permissions installs dependencies. The push-to-mainpath itself can only be exercised in real CI.release.ymlheader, a rewritten "Releases" section indocs/CONTRIBUTING.md(flow, retries, recovery, rulesets),SECURITY.md, and the release rule inCLAUDE.md.Differences from permission-reviewer#117
developbranch here: the docs describe a version-bump PR straight intomain.-rcversions publish to npmlatest, same as before.docs/CONTRIBUTING.mdandSECURITY.md.qualitynow checks out the tag on manual retries (previously it tested whatever ref the dispatch ran from;buildalready checked out the tag).release tagsruleset here cannot list the GitHub Actions app as a bypass actor (GitHub only allows that on org-level rulesets), so instead of acreationrule with a bypass, creation stays open and update, deletion and non-fast-forward are blocked. A release tag can never move or disappear; a hand-made tag still has to point at a commit onmainand match thepackage.jsonversion, orbuildstops it before anything is published. That ruleset change is already applied on the repo.After merging
package.jsonstill carries0.6.1, andv0.6.1is already tagged, so merging this PR triggers the workflow butpendingstops it green without dispatching. Nothing is released.Verification
bun run fmt:check,bun run lint,bun run typecheck: cleanbun test: 939 pass (7 new intests/release-workflow.test.ts)actionlint .github/workflows/release.yml: only the pre-existing SC2035 info on the untouched checksums step