feat(release): add bump-version script + manual-trigger release workflow#9
Merged
JohnnyVicious merged 1 commit intomainfrom Apr 12, 2026
Merged
feat(release): add bump-version script + manual-trigger release workflow#9JohnnyVicious merged 1 commit intomainfrom
JohnnyVicious merged 1 commit intomainfrom
Conversation
Codex-plugin-cc has a bump-version script and check-version CI gate but
no release automation. This PR adds both, plus a manual-trigger release
workflow on top of them so releases stop being a four-file
hand-edit-then-tag dance.
scripts/bump-version.mjs (~210 LOC, adapted from
openai/codex-plugin-cc/scripts/bump-version.mjs):
* TARGETS table covers all four version-bearing manifests in this
repo: package.json, package-lock.json (root + packages[""]),
plugins/opencode/.claude-plugin/plugin.json, and
.claude-plugin/marketplace.json (root + plugins[opencode]). Five
fields total — codex's marketplace.json keeps the version under
metadata.* but ours is at root, so the target paths are different.
* Two modes:
node scripts/bump-version.mjs 1.0.1 # bump every manifest
node scripts/bump-version.mjs --check # verify everything matches
# package.json (CI gate)
* Validates against a strict semver regex (supports prerelease and
build metadata).
* Exposes bumpVersion / checkVersions / readPackageVersion as ES
module exports so tests can call them without spawning a subprocess.
CLI dispatch is gated on `import.meta.url === file://argv[1]` so
importing the module from a test doesn't run main().
package.json:
* New scripts:
bump-version -> node scripts/bump-version.mjs
check-version -> node scripts/bump-version.mjs --check
.github/workflows/ci.yml:
* New "Check version metadata is in sync" step running
`npm run check-version`. Catches PRs that bump one manifest and
forget the others.
* Added scripts/bump-version.mjs to the syntax-check list.
.github/workflows/release.yml (new):
* `workflow_dispatch` only — never runs on push, only when the
maintainer clicks "Run workflow" in the Actions UI.
* Required input: `version` (a semver string).
* Validates the requested version is strictly greater than the
current package.json version (uses `sort -V`).
* Runs the bump, re-runs check-version as a sanity gate, runs the
full test suite against the bumped tree, then commits with
`chore(release): vX.Y.Z`, tags `vX.Y.Z`, pushes to main + tag.
* Creates a GitHub release with `gh release create --generate-notes`
so PRs since the previous tag are auto-summarised.
* `permissions: contents: write` (CI is contents: read).
tests/bump-version.test.mjs (new, 9 tests):
* Per-test tmp directory with a complete fixture set of all four
manifests.
* Covers: full bump across all five fields; prerelease semver;
malformed version rejection; checkVersions with no drift; checkVersions
reporting drift on plugin.json; reporting drift on marketplace plugin
entry; clean-bump roundtrip; readPackageVersion happy path; and
readPackageVersion rejecting malformed package.json.
Test count: 74 -> 83. All passing locally.
End-to-end smoke verified locally with `npm run check-version`,
`npm run bump-version -- 1.0.42`, manual reset to 1.0.0, and
`npm run check-version` again.
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.
Summary
Adds a manual-trigger release workflow on top of a codex-style
bump-versionscript +check-versionCI gate, so cutting a release stops being a four-file hand-edit-then-tag dance.Components
scripts/bump-version.mjs(~210 LOC)Adapted from
openai/codex-plugin-cc/scripts/bump-version.mjs. The TARGETS table covers all four version-bearing manifests in this repo (5 fields total):package.jsonversionpackage-lock.jsonversion+packages[""].versionplugins/opencode/.claude-plugin/plugin.jsonversion.claude-plugin/marketplace.jsonversion(root) +plugins[opencode].versionTwo modes:
Strict semver regex (supports prerelease + build metadata).
bumpVersion/checkVersions/readPackageVersionare exported as ES module functions so tests can call them directly without spawning subprocesses; CLI dispatch is gated onimport.meta.url === file://argv[1].package.json.github/workflows/ci.ymlnpm run check-version. Catches PRs that bump one manifest and forget the others.scripts/bump-version.mjsto the syntax-check list..github/workflows/release.yml(new)workflow_dispatchonly — never runs on push. Trigger via Actions UI → "Release" → "Run workflow".version(semver string).package.jsonversion (usessort -V).check-versionas a sanity gate, runs the full test suite against the bumped tree, then commits withchore(release): vX.Y.Z, tagsvX.Y.Z, pushes to main + tag.gh release create --generate-notesso PRs since the previous tag are auto-summarised.permissions: contents: write(CI iscontents: read).tests/bump-version.test.mjs(new, 9 tests)Per-test tmp directory with a complete fixture set of all four manifests. Covers:
2.0.0-rc.1) ✅v1.0.1,1.0,latest) ✅checkVersionswith no drift ✅checkVersionsreporting drift onplugin.json✅checkVersionsreporting drift on the marketplace plugin entry ✅readPackageVersionhappy path ✅readPackageVersionrejecting malformedpackage.json✅Test plan
npm run check-version→ "All version metadata matches 1.0.0."npm run bump-version -- 1.0.42→ updates all 4 files;check-versionpasses against 1.0.42check-versionpasses againnpm test→ 83 tests, 0 failures (was 74 → +9 new)version: 1.0.1from the Actions UI, verify it commits, tags, pushes, and creates a GitHub releaseHow to release after this lands
1.0.1)