Skip to content

Add release workflow with dual-tag versioning#56

Merged
adityamaru merged 8 commits into
mainfrom
release-workflow
Apr 30, 2026
Merged

Add release workflow with dual-tag versioning#56
adityamaru merged 8 commits into
mainfrom
release-workflow

Conversation

@adityamaru

@adityamaru adityamaru commented Apr 30, 2026

Copy link
Copy Markdown

Replaces the manual bump-tag.yaml with a workflow_dispatch release workflow modeled on the one in useblacksmith/setup-docker-builder. A single dispatch creates an annotated vX.Y.Z tag, force-updates the floating major tag (e.g. v1), and publishes a GitHub Release with auto-generated notes scoped to commits since the previous semver tag.

How it works:

  • Validates the input version against ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ and bails if the tag already exists, so typos do not produce orphan releases.
  • Runs npm ci, npm run lint, npm run build, and npm test (with the existing buf registry config and .nvmrc-pinned Node) before any tag is pushed, so a broken main never lands in a release.
  • Tags the existing commit and force-pushes the major tag only when update-major is true, preserving the escape hatch the old bump-tag.yaml provided.
  • Uses gh release create --generate-notes [--notes-start-tag <previous>], with the previous tag selected from git tag -l 'v*.*.*' --sort=-version:refname to avoid pulling in v1/v2 major aliases.

The workflow does not commit dist/; the existing PR-time guard in build.yaml keeps that artifact in sync via normal review. The legacy 1.1.0 tag (no v prefix) is ignored by the version-tag glob, so the first run will diff release notes against the most recent vX.Y.Z tag.


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews (Staging)

Replace the manual bump-tag workflow with a workflow_dispatch release
workflow that creates an annotated semver tag, force-updates the floating
major tag (e.g. v1), and publishes a GitHub Release with auto-generated
notes spanning the previous semver tag.

Inputs validate the vX.Y.Z(-prerelease) format up front and short-circuit
if the tag already exists. Build, lint, and test run before any tag is
pushed so a broken main never makes it into a release. The major tag
update is gated by the update-major input, which preserves the manual
escape hatch the deleted bump-tag.yaml provided.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Comment thread .github/workflows/release.yml Outdated
github.event.inputs.* returns strings, so the bare 'if:
github.event.inputs.update-major' was always truthy (the literal
string 'false' is truthy in GitHub Actions expressions). Compare
explicitly against 'true' to match the Summary step's check and
restore the documented escape hatch when releasing without bumping
the major tag.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml
The previous bump-tag.yaml explicitly checked out 'main', which the
new release.yml dropped, allowing a dispatch from any branch to tag
a non-main commit. Add 'ref: main' to the checkout to restore that
guarantee.

Also move every workflow_dispatch input out of '${{ ... }}'
expressions inside 'run:' bodies and into 'env:' bindings on the
step. GitHub Actions substitutes expressions before the shell sees
them, so a crafted version like 'v1.0.0"; rm -rf /; #' would have
executed before the regex check could reject it. Referencing the
inputs as shell variables ($VERSION, $UPDATE_MAJOR, $GIT_USER,
$REPOSITORY) keeps the values quoted by the shell instead.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Comment thread .github/workflows/release.yml Outdated
The Summary step already exposes $REPOSITORY (${{ github.repository
}}) for the release link, but the 'uses:' examples still hardcoded
'useblacksmith/stickydisk'. Reference $REPOSITORY in the example
block too so the summary stays correct if the repo is ever renamed
or transferred.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Comment thread .github/workflows/release.yml
The version regex permits prerelease suffixes (e.g. v2.0.0-beta.1)
and 'update-major' defaults to true, so dispatching a prerelease
would force-push the floating major tag (e.g. v2) onto unstable
code. Anyone pinning '@v2' in their workflow would then silently
pick up the beta.

Detect prerelease versions by checking for a hyphen in $VERSION
and short-circuit the tag-update step before any push. Mirror the
same guard in the Summary so it does not claim a major tag move
that did not happen. Stable releases are unaffected.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
adityamaru and others added 2 commits April 30, 2026 21:26
The Tags Created list already hides the major tag entry when
update-major is false or the release is a prerelease, but the
Usage block kept telling users to reference '$REPOSITORY@$MAJOR_VERSION'
unconditionally. For a fresh major prerelease (e.g. v2.0.0-beta.1)
that tag may not exist at all, so the recommendation could point
nowhere.

Gate the major-tag 'uses:' line behind the same condition so the
example only appears when the floating major tag was created or
updated this run. The pinned semver line is always shown.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
The version regex permits suffixes like v2.0.0-beta.1, but the gh
release create call never set --prerelease, so a beta would land on
the Releases page as a stable, latest release. Detect prereleases by
the SemVer hyphen in $VERSION and pass --prerelease via an array so
both the no-previous-tag and notes-start-tag branches stay in sync.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e7f1f21. Configure here.

Comment thread .github/workflows/release.yml Outdated
Git's default 'version:refname' sort treats v1.0.0-alpha as greater
than v1.0.0, the opposite of SemVer. Without versionsort.suffix
configured, releasing v1.0.1 when both v1.0.0 and v1.0.0-alpha exist
would pick v1.0.0-alpha as the previous tag and regenerate release
notes that already shipped with v1.0.0.

Pass '-c versionsort.suffix=-' to the git command so it treats any
'-…' suffix as a prerelease that sorts before the corresponding
stable. The query is otherwise unchanged.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@adityamaru adityamaru merged commit 13af888 into main Apr 30, 2026
12 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.

1 participant