Skip to content

ci(release): use npm trusted publishing#67

Merged
flc1125 merged 3 commits into
mainfrom
ci/npm-trusted-publishing
Jun 26, 2026
Merged

ci(release): use npm trusted publishing#67
flc1125 merged 3 commits into
mainfrom
ci/npm-trusted-publishing

Conversation

@flc1125

@flc1125 flc1125 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Move npm package publishing from a long-lived npm token to npm Trusted Publishing through GitHub Actions OIDC.

Changes

  • Remove the release workflow dependency on the npm publish token secret
  • Publish the npm package without NODE_AUTH_TOKEN, relying on the workflow id-token: write permission
  • Update release maintenance docs with npm Trusted Publisher setup steps
  • Keep the Homebrew tap token flow unchanged

Motivation

  • Avoid rotating long-lived npm publish tokens for release automation
  • Align npm publishing with short-lived OIDC credentials and the existing provenance-capable release workflow

Testing

  • Parsed .github/workflows/release.yml as YAML
  • git diff --check
  • npm pack --dry-run

Notes

  • npm package settings must configure a trusted publisher for go-tapd/cli using workflow release.yml before the next tag release.

Summary by CodeRabbit

  • Bug Fixes

    • Updated the release process to better match the current npm publishing setup.
    • Removed an outdated token check from the release flow and streamlined publishing settings.
  • Documentation

    • Revised contributor release instructions to reflect npm Trusted Publishing.
    • Updated setup, verification, and token rotation guidance for the new release credential process.

Copilot AI review requested due to automatic review settings June 26, 2026 00:53
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@flc1125, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 29 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72340111-8d7a-4877-8ac7-6cb9967faaf0

📥 Commits

Reviewing files that changed from the base of the PR and between 76a1cfe and 501edf6.

📒 Files selected for processing (1)
  • CONTRIBUTING.md
📝 Walkthrough

Walkthrough

The release workflow now validates only TAP_GITHUB_TOKEN, disables Node package-manager caching, and publishes npm without provenance or NODE_AUTH_TOKEN. CONTRIBUTING.md replaces NPM_TOKEN release instructions with npm Trusted Publishing guidance, updated verification, token rotation, and a new reference.

Changes

Release publishing credentials

Layer / File(s) Summary
Release job auth and npm publish
.github/workflows/release.yml
The release job removes the NPM_TOKEN pre-check, disables package-manager caching in Node setup, and publishes npm without NODE_AUTH_TOKEN or --provenance.
Release credential setup
CONTRIBUTING.md
The contributor guide renames the release secrets section, replaces NPM_TOKEN requirements with npm Trusted Publishing, and adds the setup and verification steps.
Token rotation and reference
CONTRIBUTING.md
The contributor guide updates token rotation steps around TAP_GITHUB_TOKEN and adds the npm Trusted Publishing reference.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • go-tapd/cli#12: Also changes the GitHub Actions release workflow around GoReleaser and release-related pipeline wiring.
  • go-tapd/cli#13: Also touches .github/workflows/release.yml token handling for TAP_GITHUB_TOKEN in the release flow.
  • go-tapd/cli#15: Adjusts the same npm publish path with NPM_TOKEN validation and provenance settings that this PR removes.

Poem

I hopped by moonlit release light, 🐇
With trusted publishing tucked in tight.
TAP token set, the carrots glowed,
npm sang as the new steps flowed.
Hoppy puffs and whiskers bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: switching release publishing to npm Trusted Publishing.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/npm-trusted-publishing

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the CONTRIBUTING.md documentation to reflect the transition from using a long-lived NPM_TOKEN repository secret to using npm Trusted Publishing with GitHub Actions OIDC. The feedback points out a minor inaccuracy in the step-by-step instructions for configuring the trusted publisher on npmjs.com, suggesting a correction to match the actual npm user interface.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread CONTRIBUTING.md Outdated
Comment on lines +75 to +76
9. Allow the `npm publish` action.
10. Save the trusted publisher configuration.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

In the npm Trusted Publisher setup UI, there is no option or step to "Allow the npm publish action". After filling in the workflow details, the user simply clicks the "Add publisher" button to save the configuration. Combining these steps makes the instructions more accurate to the actual npm interface.

Suggested change
9. Allow the `npm publish` action.
10. Save the trusted publisher configuration.
9. Click Add publisher to save the configuration.

Copilot AI 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.

Pull request overview

This PR updates the release process for the tapd CLI to publish the @go-tapd/tapd npm wrapper via npm Trusted Publishing (GitHub Actions OIDC), removing reliance on a long-lived npm token secret.

Changes:

  • Updates the release workflow to stop using NPM_TOKEN / NODE_AUTH_TOKEN for npm publish.
  • Adjusts the workflow’s Node setup configuration for the npm publish step.
  • Revises release maintenance documentation to describe npm Trusted Publishing setup and removes npm token secret guidance.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
CONTRIBUTING.md Updates release credential documentation to replace NPM_TOKEN instructions with npm Trusted Publishing setup steps.
.github/workflows/release.yml Removes npm token checks/auth env usage and updates the npm publish step to rely on OIDC-based publishing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

run: |
node scripts/set-version.js "$GITHUB_REF_NAME"
npm publish --access public --provenance
npm publish --access public
Comment thread CONTRIBUTING.md Outdated
Comment on lines +118 to +120
### Rotate Expired Tokens

When a token is close to expiration:
When `TAP_GITHUB_TOKEN` is close to expiration:

@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: 1

🧹 Nitpick comments (1)
CONTRIBUTING.md (1)

83-116: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add an explicit trusted-publisher verification step.

Lines 85-116 only verify TAP_GITHUB_TOKEN and local npm metadata, and Lines 114-116 already note that this still does not validate the OIDC binding. Add a manual check that the npm package settings still point to go-tapd/cli and release.yml; otherwise maintainers can finish every documented verification step and still hit a failed release.

Suggested addition
 ### Verify Release Configuration
@@
 Expected results:
@@
 - `npm publish --access public --dry-run` prints the package contents and ends
   with `+ `@go-tapd/tapd`@...`.
+
+Manual check:
+
+- Re-open the npm package settings and confirm the trusted publisher entry still
+  targets `go-tapd/cli` and workflow `release.yml`.
🤖 Prompt for 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.

In `@CONTRIBUTING.md` around lines 83 - 116, Add an explicit trusted-publisher
verification step in the release verification section, since the current checks
in CONTRIBUTING.md only cover the GitHub secret and local npm metadata and still
miss the OIDC binding. Update the release checklist near the existing npm
validation steps to tell maintainers to manually confirm the npm package
settings still reference go-tapd/cli and release.yml, using the same Verify
Release Configuration section so it is exercised before release workflows run.
🤖 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 67-69: The release workflow’s npm publish step is missing
provenance even though it already has GitHub OIDC enabled. Update the publish
command in the release job to restore the provenance flag on the npm publish
invocation, and verify the change in the workflow section that runs set-version
and publishes the package.

---

Nitpick comments:
In `@CONTRIBUTING.md`:
- Around line 83-116: Add an explicit trusted-publisher verification step in the
release verification section, since the current checks in CONTRIBUTING.md only
cover the GitHub secret and local npm metadata and still miss the OIDC binding.
Update the release checklist near the existing npm validation steps to tell
maintainers to manually confirm the npm package settings still reference
go-tapd/cli and release.yml, using the same Verify Release Configuration section
so it is exercised before release workflows run.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd65cc50-83ef-4514-9401-9b49f7e9322b

📥 Commits

Reviewing files that changed from the base of the PR and between 2dc1c46 and 76a1cfe.

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

Comment on lines 67 to +69
run: |
node scripts/set-version.js "$GITHUB_REF_NAME"
npm publish --access public --provenance
npm publish --access public

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the release workflow around the referenced lines
git ls-files .github/workflows/release.yml
echo '---'
cat -n .github/workflows/release.yml | sed -n '1,160p'

echo '--- search provenance usage ---'
rg -n --hidden --glob '.github/workflows/*.yml' --glob '.github/workflows/*.yaml' 'provenance|npm publish|id-token|permissions:' .github/workflows

Repository: go-tapd/cli

Length of output: 2532


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find any repo docs/config mentioning npm provenance or trusted publishing
rg -n --hidden 'provenance|trusted publishing|trusted-publishing|OIDC|id-token|npm publish' .

Repository: go-tapd/cli

Length of output: 1076


Restore --provenance on npm publish. .github/workflows/release.yml:69 already uses GitHub OIDC (id-token: write), so dropping --provenance stops emitting provenance for released packages.

🤖 Prompt for 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.

In @.github/workflows/release.yml around lines 67 - 69, The release workflow’s
npm publish step is missing provenance even though it already has GitHub OIDC
enabled. Update the publish command in the release job to restore the provenance
flag on the npm publish invocation, and verify the change in the workflow
section that runs set-version and publishes the package.

@flc1125 flc1125 merged commit d34a853 into main Jun 26, 2026
4 checks passed
@flc1125 flc1125 deleted the ci/npm-trusted-publishing branch June 26, 2026 01:05
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