This document is the source of truth for cutting and validating releases.
Cut releases from the repository default branch only (typically main):
npm run release:patch
npm run release:minor
npm run release:majorThese commands route through:
npm run release -- <patch|minor|major>scripts/release.js enforces and performs the following, in order:
- Resolves and confirms branch is the repository default branch.
- Confirms working tree is clean.
- Confirms
HEADmatchesorigin/<default-branch>. - Confirms latest
ci.ymlpush run forHEADis green and required jobs succeeded. - Runs
npm run verify. - Runs
npm version <bump> -m "release: v%s". - Pushes the default branch commit plus the release tag atomically (
git push --atomic origin <default-branch> <tag>). - Waits for GitHub Release visibility.
Remote CI gate notes:
- Requires authenticated
ghCLI. - Override only for emergency/manual recovery with
RELEASE_SKIP_REMOTE_CI_GATE=1.
Failure behavior:
- If the GitHub release workflow fails after the atomic branch+tag push succeeds, the script may auto-rollback by reverting the tagged commit on the default branch and deleting the remote tag.
- Auto-rollback is skipped when npm publish already succeeded, publish status is unknown, or the failure happened before the release-workflow phase.
Run this locally before any release command:
npm run verifyverify runs:
npm run check:esm-importsnpm run lintnpm run format:checknpm run typechecknpm run typecheck:testnpm run test:anti-mocknpm run test:coveragenpm run check:coverage-ratchetnpm run check:docsnpm run buildnpm run check:dist-esm-importsnpm run smoke:cli:dist
npm run check:coverage-ratchet is regression-only: it protects touched existing covered source files from coverage drops, while npm run test:coverage still records the full repo snapshot for visibility.
Recommended additional checks:
npm run test- Keep release-intended changes in
## Unreleasedwhile developing. - Immediately before release, move them into the versioned section being cut.
- Keep notes user-facing and behavior-oriented, not implementation-only.
GitHub Actions handle verification and publish automation:
.github/workflows/ci.yml- runs on pull requests and pushes to
main - runs one full verify job on Ubuntu with Node
22.x - includes packed tarball execution smoke
- includes Windows compatibility smoke
- includes security dependency audit gate
- runs on pull requests and pushes to
.github/workflows/release.yml- on
v*tag push, installs dependencies, runsnpm run verifyon Node22.x, publishes to npm with Trusted Publishing, and creates GitHub Release - publish job runs on Node
22.x, enforces npm>=11.5.1, and fails early unless GitHub OIDC metadata + token claims match repository/workflow/environment expectations
- on
Run a quick live pass in OpenCode:
opencode auth login- Add at least two accounts in one session
- Check quotas (
5h,Weekly,Credits) - Toggle one account enabled/disabled
- Refresh one account token
- Delete one account, then delete-all (scoped and full)
- Confirm delete-all does not immediately repopulate
- Run one real prompt using an available
openai/*model - Confirm no malformed tool output in session
- Create npm package
@iam-brain/opencode-codex-auth(public). - Configure npm Trusted Publishing for:
- repo:
iam-brain/opencode-codex-auth - workflow:
.github/workflows/release.yml - environment:
npm-release
- repo:
- Ensure GitHub Actions are enabled for the repo.
npm-publish in .github/workflows/release.yml validates all of the following before npm publish:
GITHUB_REPOSITORYmatchesiam-brain/opencode-codex-auth.GITHUB_WORKFLOW_REFpoints at.github/workflows/release.yml.ACTIONS_ID_TOKEN_REQUEST_URLandACTIONS_ID_TOKEN_REQUEST_TOKENare present.- An OIDC token can be minted for
audience=npmjs. - Decoded OIDC claims match:
- repository:
iam-brain/opencode-codex-auth - workflow:
.github/workflows/release.yml - environment:
npm-release
- repository:
If release publish fails with ENEEDAUTH:
- Confirm npm Trusted Publisher mapping exactly matches:
- repo
iam-brain/opencode-codex-auth - workflow
.github/workflows/release.yml - environment
npm-release
- repo
- Confirm release publish job still has
id-token: write. - Confirm preflight logs report a successful OIDC claim validation pass.
- Confirm publish job runtime is Node
>=22.14and npm>=11.5.1. - Re-run release after fixing mapping/runtime mismatch.
- Do not run release commands unless publishing is intended.
- Do not manually edit generated
dist/files. - Prefer script-driven release flow over manual git tagging.