Skip to content

chore: simplify release workflow using changesets publish gating - #141

Merged
mynameistito merged 4 commits into
mainfrom
chore/tighten-release-workflow
Jun 24, 2026
Merged

chore: simplify release workflow using changesets publish gating#141
mynameistito merged 4 commits into
mainfrom
chore/tighten-release-workflow

Conversation

@mynameistito

@mynameistito mynameistito commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Collapse the split main (changesets only) / staging (publish + release) flow into a single main-triggered workflow, matching the pattern in codex-usage
  • Split into two jobs for efficiency:
    • version — lightweight changesets-only path (no build) when opening/updating the version packages PR
    • publish — build, SBOM, npm stage, and GitHub release only when hasChangesets == 'false'
  • Add idempotent publish logic: skip if already on npm, skip if already staged, otherwise npm stage publish . --provenance
  • Keep repo-specific hardening: harden-runner, commitMode: github-api for GPG-signed version commits, CycloneDX SBOM on releases, registry-url for npm OIDC provenance, job timeouts
  • Document staging branch retirement in CONTRIBUTING.md

Staging / rulesets cleanup

  • Verified GitHub rulesets only target refs/heads/mainno ruleset changes required
  • Remote staging branch is already deleted
  • Deleted stale local branches staging and fix/release-staging-oidc

Test plan

  • Actionlint passes on .github/workflows/release.yml
  • Merge a changeset PR → verify chore: version packages PR opens (version job only; publish job skipped)
  • Merge version packages PR → verify publish job stages npm publish with provenance and creates GitHub release with SBOM
  • Re-run workflow on same commit → verify idempotent skip paths (already published / already staged / release exists)

Note

Simplify release workflow by splitting versioning and publish into separate gated jobs

  • Replaces the monolithic release job in release.yml with two jobs: version (creates/updates a version packages PR via changesets) and publish (builds, stages npm publish with provenance, and creates a GitHub release).
  • The publish job is gated on has_changesets == 'false', so it only runs after the version packages PR is merged.
  • SBOM generation (npm sbom to CycloneDX) and GitHub release creation (with changelog notes) are now part of the publish job unconditionally, without branch-conditional logic.
  • Removes the staging branch from workflow triggers; all automation now runs on main only.
  • Updates CONTRIBUTING.md to reflect the new two-step release flow and note that maintainers must approve staged publishes on npmjs.com.

Macroscope summarized 0bd3478.

Collapse the staging-branch publish path into main so version-package
merges trigger npm staging and GitHub releases directly, matching the
codex-usage pattern while keeping GPG-signed changesets and SBOM output.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0bd3478

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release workflow is updated to trigger only on pushes to main (removing staging). Setup steps are standardized to Bun 1.3.14. The staging-specific two-path publish/release logic is replaced with a single conditional block that runs when changesets reports no pending changesets, performing SBOM generation, version checks, npm stage publish with provenance, and GitHub release creation. CONTRIBUTING.md is updated to match.

Changes

Release Pipeline Consolidation

Layer / File(s) Summary
Trigger, permissions, and build setup
.github/workflows/release.yml
Push trigger narrowed to main only, id-token: write and pull-requests: write permissions retained with reordered entries, Bun pinned to 1.3.14, npm updated globally, and install/build standardized to bun install --frozen-lockfile / bun run build.
Conditional publish and GitHub release steps
.github/workflows/release.yml
Staging-specific publish/release blocks replaced by a hasChangesets == 'false'-gated pipeline: reads package.json metadata, generates sbom.json, checks whether the version is already published or staged, calls npm stage publish with provenance, and creates a GitHub release from CHANGELOG.md with sbom.json attached (skipping if the release exists).
Release process docs
CONTRIBUTING.md
Step 3 updated to describe that merging the version-packages PR triggers release.yml to rerun and—when no changesets remain—executes the npm stage publish and GitHub release creation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • mynameistito/create-cf-token#11: Introduced the Changesets-based release workflow in release.yml that this PR directly refactors, including the changesets/action usage and provenance publish step.
  • mynameistito/create-cf-token#23: Modified the same release.yml Bun setup and install/build steps that are further adjusted in this PR.

Poem

🐇 Hop, hop, no more staging lane,
Just main where releases reign!
Bun is pinned, the SBOM grows,
npm stage publish — off it goes.
A GitHub release, neat and clean,
The fluffiest pipeline you've seen! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: simplifying the release workflow with changesets-based publish gating.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description matches the workflow and documentation changes, including the main-only release flow, gated publish job, idempotent publish logic, and CONTRIBUTING updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tighten-release-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/create-cf-token@6da072e

commit: 6da072e

Run changesets in a lightweight version job and only build, SBOM,
publish, and release when hasChangesets is false. Restore registry-url
for npm OIDC provenance and add job timeouts.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/create-cf-token@3b00818

commit: 3b00818

Use pinned npm via setup-node instead of npm@latest, read package.json
directly in shell steps to avoid template injection, and drop the
redundant metadata step that triggered shellcheck SC2129.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/create-cf-token@2c5c9a8

commit: 2c5c9a8

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 88-89: The release workflow currently interpolates step outputs
from the package step directly inside shell scripts, which is unsafe because the
values are expanded before Bash quoting applies. Move the package metadata from
steps.package.outputs.* into env variables for the affected shell blocks, then
reference those env vars at runtime with proper quoting. Update the shell steps
around the package handling logic in the release workflow, including the later
section that uses the same outputs, so all package_name/package_version usage
comes from env instead of direct expression interpolation.
- Around line 98-136: The preflight check in the release workflow is swallowing
failures from npm stage list by using a fallback that hides auth/permission
errors, which can cause the later npm stage publish path to fail unnecessarily.
Update the staged-package detection logic in the release job to handle npm stage
list errors explicitly using the existing
staged_json/package_name/package_version check, or bypass this preflight when
running in OIDC-only mode, so already-staged versions exit cleanly instead of
falling through.

In `@CONTRIBUTING.md`:
- Line 120: The release-flow description in CONTRIBUTING.md is missing the final
npm approval step after staging the publish. Update the text around the release
workflow to mention that after `release.yml` stages the npm publish with
provenance and creates the GitHub release, a maintainer must complete the npm
approval/2FA step before the package is publicly installable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 204acfb9-965e-4a02-be4f-d5aab22687ac

📥 Commits

Reviewing files that changed from the base of the PR and between 69dbec1 and 6da072e.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • CONTRIBUTING.md

Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread CONTRIBUTING.md Outdated
Fail fast on auth errors from npm stage list instead of swallowing
them, and note the maintainer npm approval step in CONTRIBUTING.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/create-cf-token@0bd3478

commit: 0bd3478

@mynameistito
mynameistito merged commit 01e5ab7 into main Jun 24, 2026
28 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.

2 participants