Releases
This guide is for the repository maintainer. Releases use one manual Release workflow, a main-only environment, immutable exact tags, and a movable major alias. There is no semantic-release path.
This is a solo-maintained project. The maintainer starts each operation; no second reviewer is required. Dry runs and explicit confirmation protect against unintended publication.
The workflow also publishes the npm package during publish, with provenance.
Trunk and tag policy
- All changes land on
mainfirst.mainis the only source of new work. - Release branches (
release/vX.Y) receive only approved squash backports of commits that already exist onmain. - Never merge a release branch back into
main. Fix forward onmainand backport the fix. - Never delete a published release or its tag. Correct a bad release by publishing a new patch version.
- Exact version tags (
X.Y.Z,X.Y.Z-rc.N) are immutable. Once pushed, a tag keeps its target commit forever. - The major alias tag (
X) is movable. It points at the highest stable release of that major line.
Versions are canonical SemVer with no leading v: 1.0.0 or 1.0.0-rc.1.
One-time repository setup
Complete this checklist before publishing. The guard enforces the environment restrictions; it does not verify npm setup or all repository settings.
- Create a
releaseenvironment with no required reviewers, administrator bypass disabled, and a sole custom deployment branch policy ofmain. - Confirm that the maintainer can dispatch Actions workflows. Run every release operation from
main. - Enable npm trusted publishing for
@josevelaz/opencode-codex-native-compaction: GitHub ownerjosevelaz, repositoryopencode-codex-native-compaction, workflow filenamerelease.yml, environmentrelease, permissionnpm publish. Do not store anNPM_TOKEN. The package must exist before you can configure a trusted publisher; see the bootstrap procedure below. - Enable auto-merge and squash merge. The
backportoperation opens squash-merge pull requests. - Enable Immutable Releases so published release tags cannot be moved or deleted.
- Keep the existing validation workflows enabled. Release execution runs validation before it plans mutations.
- Keep branch rules compatible with workflow-created version commits and branch deletion. The workflow uses only
GITHUB_TOKEN, with no bypass token. - Do not require another person’s approval for this solo-maintained release process.
- Do not create a ruleset that targets release tags or major aliases. The workflow moves only the major alias
X. - Do not pre-create release branches or tags. The workflow creates every line it owns.
Bootstrap the npm package once
Skip this procedure if the package already exists. This is the one-time exception to workflow-based publication: npm requires an existing package before it accepts a trusted publisher.
- Sign in to npm, verify your email, and enable account-level two-factor authentication (2FA).
- In your own terminal, run
npm loginand complete its browser and 2FA prompts. Confirm the account withnpm whoami. Keep credentials out of the repository and issue reports. - From the clean, reviewed checkout, run
bun run validateandbun run pack:check. Confirm thatpackage.jsonnames@josevelaz/opencode-codex-native-compaction, is version0.0.0, and that this version has never been published. -
Publish under a non-default tag:
npm publish --access public --tag bootstrap --provenance=falseThis permanently uses version
0.0.0. Local publication cannot produce GitHub Actions provenance. Thebootstraptag avoids assigning this version tolatest. -
Configure the GitHub Actions trusted publisher in npm package settings using the values above. With npm 11.15.0 or later, you can also run:
npm trust github @josevelaz/opencode-codex-native-compaction \ --repo josevelaz/opencode-codex-native-compaction \ --file release.yml \ --env release \ --allow-publish - In npm publishing-access settings, require 2FA and disallow tokens. Trusted publishing still works with this setting. Remove the temporary CLI credential with
npm logoutwhen setup is complete. - Use the workflow below to cut, draft, and publish
0.1.0. Later releases use GitHub Actions OIDC and provenance, not the bootstrap procedure.
See npm’s trusted publisher prerequisites. A saved binding is not proof that OIDC works: the owner, repository, workflow filename, and environment must all match the actual run.
Operations
Every operation accepts dry_run. A dry run plans the work, writes artifacts, and does not mutate repository or registry state. dry_run defaults to true. Every run uses the main-only release environment without a reviewer gate.
The examples below use 1.0.0 to show the version format, not to claim that version is published. Use the intended release version; 0.1.0 is suitable for the first experimental release.
Always pass --ref main. The guard rejects any other ref.
Each operation accepts only its own fields plus dry_run. A populated field that the operation does not use is a hard input error.
gh workflow run Release --ref main \
-f operation=cut \
-f version=1.0.0 \
-f dry_run=true
From the Actions UI, open Actions → Release → Run workflow, select main, choose the operation, fill that operation’s fields, and leave dry_run checked. Read the plan, then re-run with -f dry_run=false.
cut
Creates release/vX.Y from main. version must be an initial line version with patch 0.
gh workflow run Release --ref main \
-f operation=cut \
-f version=1.0.0 \
-f dry_run=true
backport
Opens a squash-merge pull request that replays trunk commits onto an existing release line, in the order given.
gh workflow run Release --ref main \
-f operation=backport \
-f release_line=release/v1.0 \
-f commits=1111111111111111111111111111111111111111 \
-f dry_run=true
draft
Sets package.json on the release line, pushes the exact version tag, and creates a draft GitHub Release. version must belong to release_line.
gh workflow run Release --ref main \
-f operation=draft \
-f release_line=release/v1.0 \
-f version=1.0.0 \
-f dry_run=true
publish
Moves the major alias X when this is the highest stable tag of that major line, publishes the existing GitHub draft, then publishes to npm with provenance. RC releases use the npm dist-tag next and do not move a major alias.
Partial-publication limit: npm publication runs after the GitHub Release becomes public. If npm fails, the GitHub Release remains published and this operation cannot simply be rerun because it requires a draft. Confirm npm setup before running live. If publication fails, inspect both registries and preserve the published tag; do not delete a published release to retry.
confirmation must be exactly publish <version>.
gh workflow run Release --ref main \
-f operation=publish \
-f version=1.0.0 \
-f confirmation='publish 1.0.0' \
-f dry_run=true
cancel
Deletes an unpublished draft and its exact version tag. Use it only before publication.
confirmation must be exactly cancel <version>.
gh workflow run Release --ref main \
-f operation=cancel \
-f version=1.0.0 \
-f confirmation='cancel 1.0.0' \
-f dry_run=true
If a cancel run stops partway through, inspect its artifacts and the live tag before taking further action. The CLI accepts a resume_proof field for recovery, but the workflow does not generate that proof automatically. Do not assume a normal rerun can finish every partial cancellation.
retire
Deletes a release branch. Published tags and releases are never touched.
confirmation must be exactly retire <release_line>.
gh workflow run Release --ref main \
-f operation=retire \
-f release_line=release/v1.0 \
-f confirmation='retire release/v1.0' \
-f dry_run=true
restore
Recreates a retired release branch at its highest stable-version tag, excluding RC tags. The planner selects by tag version, not GitHub publication state. Before running it, confirm that the highest stable-version tag has a published release rather than an unpublished draft.
gh workflow run Release --ref main \
-f operation=restore \
-f release_line=release/v1.0 \
-f dry_run=true
How a run proceeds
- Guard. A job with only
actions: readchecks that the ref isrefs/heads/mainand that thereleaseenvironment disables administrator bypass and has a sole deployment branch policy namedmain. It never declares the environment itself, because referencing a missing environment would create it without restrictions. - Execution. The
Executejob targets the main-onlyreleaseenvironment. The maintainer’s manual dispatch starts the run without a second reviewer. - Serialization. The workflow uses the concurrency group
releasewithcancel-in-progress: false. Running operations do not overlap or cancel each other. GitHub can replace a pending run when another is queued, so dispatch one operation at a time and wait for its result. - Exact-SHA checkout. Execute checks out the dispatch SHA, not a moving
mainref, then validates the package before it plans mutations. - Artifacts. Every run writes
release-plan.jsonandrelease-result.json. Draft runs also writerelease-notes.md.