Skip to content

ci(publish): stage, tag and release on a package.json version bump - #53

Merged
simoncrypta merged 1 commit into
mainfrom
ci/release-on-version-bump
Oct 8, 2026
Merged

simoncrypta merged 1 commit into
mainfrom
ci/release-on-version-bump

Conversation

@simoncrypta

Copy link
Copy Markdown
Collaborator

What

publish.yml now runs when a package.json change lands on main, instead of when a GitHub release is published.

  • resolve job: reads the version and checks whether v<version> already exists on the remote. If it does (for example a dependency-only package.json change), nothing else runs.
  • publish job, when the tag is missing:
    1. Extracts the ## <version> CHANGELOG section. If it's missing or empty, the job fails before staging anything.
    2. Runs vp check, vp test and vp run smoke.
    3. Stages the npm publish with vp pm stage publish. The dist-tag logic is unchanged.
    4. Runs gh release create v<version> --target <merged sha> with that CHANGELOG section as the notes. A version with a - becomes a prerelease (not latest); otherwise the release is marked latest.
  • workflow_dispatch: kept as the manual way to re-stage. It also creates the tag and release if they're missing.
  • Concurrency: a publish concurrency group means two quick merges don't race.

The release flow becomes: open a release PR (bump the version, rename ## Unreleased → ## <version>), merge it, then approve the staged publish with 2FA (vp pm stage approve <stage-id>).

Why the release trigger is removed

With release: published, publishing a release staged the same version a second time. 0.3.0 was already staged through workflow_dispatch, so a release created by hand would have staged it again. The release is now an output of the workflow, created with GITHUB_TOKEN, so it doesn't trigger other workflows.

Notes

  • The file name stays publish.yml, because the npm Trusted Publisher (OIDC) is bound to it.
  • Permissions: resolve gets contents: read. publish gets contents: write, to create the tag and release, and id-token: write.
  • This PR doesn't touch package.json, so merging it won't run the workflow.
  • v0.3.0 is already tagged on 02da986 and has a draft release. It's a draft because the old trigger would have re-staged 0.3.0. After this merges, it can be published by hand without starting a publish. Later versions are tagged and released by the workflow.
  • AGENTS.md (packaging checklist) and the preview.yml comment now describe the new flow.

Checks

  • vp check: pass.
  • The workflow YAML parses.
  • I dry-ran the resolve and CHANGELOG logic locally:
    • 0.3.0: tag exists, so the run would be skipped.
    • A version with no CHANGELOG section: the job fails before staging.
  • actionlint isn't installed locally, so it wasn't run.
  • The real end-to-end test is the next version-bump merge.

🤖 Generated with Claude Code

Merging a version bump to main now runs publish.yml: gates, npm stage publish,
then tag v<version> on the merged commit and create the GitHub release with
the matching CHANGELOG section as notes (prerelease when the version has `-`).
A package.json push whose tag already exists does nothing. The release
trigger is removed, so a release no longer re-stages the same version;
workflow_dispatch stays as the manual re-stage fallback.

The workflow file name is unchanged: npm Trusted Publisher is bound to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 9100a4e7-200a-43a8-a8d0-d2fb0cf7256f
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cedarjs/pg@53

commit: 2d76c81

@simoncrypta
simoncrypta merged commit 46dd5b4 into main Oct 8, 2026
4 checks passed
@simoncrypta
simoncrypta deleted the ci/release-on-version-bump branch October 8, 2026 19:23
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