ci(publish): auto-tag + GitHub Release on each npm publish#104
Conversation
Triggered when either web or cli publishes. Tag uses the CLI version (v0.1.0-beta.5 etc) since that's what users `npx`. Release body lists whichever package(s) shipped this run, so a web-only or cli-only bump still produces a record. --generate-notes appends auto-summarized commit history. This is what populates the Releases tab on the GitHub repo — without this, npm publishes leave no trace on github.com beyond the bump commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe publish workflow grants ChangesGitHub Release Automation
Sequence Diagram(s)sequenceDiagram
participant PublishJob as Publish Job
participant npm as npm registry
participant GH as GitHub CLI
PublishJob->>npm: publish `@openhop/web` and openhop CLI (conditional)
PublishJob->>PublishJob: compute tag (v$CLI_VERSION / cli/v$CLI_VERSION / web/v$WEB_VERSION)
PublishJob->>GH: gh release view <tag>
GH-->>PublishJob: exists? (yes/no)
alt not exists
PublishJob->>GH: gh release create --title --notes --generate-notes
else exists
PublishJob-->>PublishJob: skip release creation
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/publish.yml:
- Around line 100-106: The workflow always sets tag="v$CLI_VERSION" and then
skips the run if that tag exists, which causes web-only publishes to be dropped
when CLI_VERSION is unchanged; update the tag/collision check to use the correct
publish target: compute the tag based on which publish is being performed (e.g.,
use v$WEB_VERSION when only web publish is enabled, or guard the gh release view
check behind the CLI publish condition), and only run the gh release view + exit
branch when the tag variable corresponds to the current publish (reference the
tag variable and the gh release view conditional in the existing step).
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 91c13f4b-ce67-4f0d-aa32-e3de1cfeb3a8
📒 Files selected for processing (1)
.github/workflows/publish.yml
Previously the workflow always tagged v$CLI_VERSION. A web-only bump (CLI version unchanged) would match an existing tag from a prior combined release and skip — leaving the web-only publish without a GitHub Release record. (Caught by CodeRabbit on #104.) New scheme: both shipped → v$CLI_VERSION (combined) cli only → cli/v$CLI_VERSION web only → web/v$WEB_VERSION The skip-if-exists check now runs against the tag we're actually about to create, not an unrelated one. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/publish.yml:
- Around line 93-101: Add stable IDs to the actual publish steps (set id:
publish_web on the web publish step and id: publish_cli on the CLI publish
step), then change the release job's if condition to gate on actual publish
outcomes using always() && (steps.publish_web.outcome == 'success' ||
steps.publish_cli.outcome == 'success'); also update the WEB_PUBLISHED and
CLI_PUBLISHED environment variables in the release step to reference
steps.publish_web.outcome and steps.publish_cli.outcome respectively instead of
the pre-check outputs so the release only runs when a publish step truly
succeeded.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 41e408af-a65d-42c4-967e-d2312439b02c
📒 Files selected for processing (1)
.github/workflows/publish.yml
…ck intent Previously the release step gated on whether we planned to publish (`steps.<>_status.outputs.publish == 'true'`). A failed `npm publish` (network, auth, registry rejection) would still trigger the release step and produce a "successful publish" record on GitHub. Now: - The publish steps have stable ids (`publish_web`, `publish_cli`). - The release step's `if:` keys off `steps.publish_*.outcome == 'success'`, with `always()` so it stays eligible after a conditionally-skipped publish. - WEB_PUBLISHED / CLI_PUBLISHED env vars come from the same outcome expressions, so the release notes only list packages that actually shipped. (Caught by CodeRabbit on #104.) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extends `.github/workflows/publish.yml` so every successful npm publish is also recorded as a git tag and a GitHub Release. Without this, npm publishes leave no trace on github.com beyond the bump commit — and the Releases tab stays empty (which is what you noticed after the repo went public).
Behavior
Required permission bump: `contents: read` → `contents: write` on the workflow.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit