Skip to content

Semver bump by branch prefix (fix/feat/release -> patch/minor/major) - #16

Merged
heitorsDev merged 1 commit into
mainfrom
feat/semver-bump-by-branch-prefix
Aug 9, 2026
Merged

heitorsDev merged 1 commit into
mainfrom
feat/semver-bump-by-branch-prefix

Conversation

@heitorsDev

Copy link
Copy Markdown
Owner

Closes #15

Summary

Replaces the "version is read literally from the release/x.y.z branch
name" model (ADR 0006/#7) with automatic semver bumping, per
ADR 0008:

  • src/release/next-version.js replaces parse-version.js:
    • bumpTypeFromBranch(branchName) — fix/* -> "patch", feat/* ->
      "minor", release/* -> "major", anything else -> null.
    • bumpVersion(currentVersion, bumpType) — latest tag + bump type ->
      next version string (minor resets patch to 0, major resets both).
  • bin/next-version.js replaces bin/parse-version.js as the CLI the
    workflow shells out to.
  • .github/workflows/release.yml: the job's if guard now checks for
    fix/, feat/, or release/ prefixes (previously only release/).
    The version step now reads the latest vX.Y.Z tag (semver-sorted, not
    by creation date) and computes the next version from it + the merging
    branch's prefix, instead of parsing the branch name itself.
  • fix/* and feat/* can now merge straight into main (not forced
    through a release/* staging branch) and each still triggers its own
    bump. release/* branches keep working as an optional integration
    branch for staging multiple PRs first (unchanged from ADR 0006) — that
    intermediate merge never bumps anything; only the final release/* -> main merge does, always as a major bump.

Test plan

  • 8 new TDD seams (issue Semver bump by branch prefix (fix/feat/release -> patch/minor/major) #15's spec) green — bumpTypeFromBranch (4
    cases) + bumpVersion (4 cases). Full suite 27/27.
  • npm run lint clean.
  • bin/next-version.js smoke-tested directly: "0.0.0" "feat/x" ->
    0.1.0; "0.0.0" "docs/x" -> stderr + exit 1.
  • Verified against the real repo state: latest tag is v0.0.0
    (confirmed via git tag --list 'v*' --sort=-v:refname), and this
    branch's own name (feat/semver-bump-by-branch-prefix) computes to
    0.1.0 — i.e. merging this very PR is expected to tag v0.1.0 and
    create release 0.1.0, which will be the live end-to-end
    verification of the new workflow.

…nch-name (issue #15, ADR 0008)

Replaces parse-version.js (branch name -> literal version) with
next-version.js: bumpTypeFromBranch (fix/feat/release -> patch/minor/
major) + bumpVersion (latest tag + bump type -> next version). The
release workflow now computes the version from the latest git tag
(semver-sorted) instead of reading it out of the release/x.y.z branch
name — fix/*, feat/*, and release/* can all merge directly to main,
each triggering its own bump; release/* branches remain optional
integration staging (unchanged from ADR 0006) but no longer need a
version baked into their name.

8 TDD seams green (27/27 total). Verified locally against the real
v0.0.0 tag: bin/next-version.js "0.0.0" "feat/semver-bump-by-branch-prefix"
-> 0.1.0, matching this very branch's expected bump.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@heitorsDev
heitorsDev merged commit 395b3d1 into main Aug 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Semver bump by branch prefix (fix/feat/release -> patch/minor/major)

1 participant