Skip to content

ci: publish to npm with trusted publishing (7.0.7) - #110

Open
shumkov wants to merge 2 commits into
masterfrom
shumkov/npm-trusted-publishing
Open

shumkov wants to merge 2 commits into
masterfrom
shumkov/npm-trusted-publishing

Conversation

@shumkov

@shumkov shumkov commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The v7.0.6 release never reached npm. Its release job, and the re-run on 2026-11-20, failed at npm publish with E404 Not Found - PUT https://registry.npmjs.org/@dashevo%2fdashcore-node: the org NPM_TOKEN secret (last updated 2022) can no longer publish. Insight on Dash Core v24 networks needs this release.

Changes

  • Release job publishes with npm trusted publishing. npm exchanges the job's GitHub OIDC token for a short-lived publish token and adds a provenance attestation, so NPM_TOKEN is no longer used. The job is a copy of ci: publish to npm with trusted publishing dashcore-lib#326, which published dashcore-lib 0.26.1 this way:
    • permissions: contents: read, id-token: write on the release job only;
    • only GitHub's own actions, pinned to commits; Node 24.14.1 (npm 11.11.0, trusted publishing needs 11.5.1 or later);
    • the tag/version check and the dist-tag are plain shell, replacing geritol/match-tag-to-package-version and actions/github-script;
    • nothing is installed, and npm publish --ignore-scripts, so no package script runs while the OIDC token is available. The tarball has the same 77 files as 7.0.5.
    • --loglevel verbose, the only level at which npm logs why an OIDC exchange failed.
  • package.json names dashpay/dashcore-node (repository, bugs, homepage). Provenance requires repository.url to match the repository that publishes.
  • Version 7.0.7. A re-run of the v7.0.6 release uses the workflow at the v7.0.6 tag, which still uses the token, so this needs a new version. Same code as 7.0.6.

The npm trusted publisher for @dashevo/dashcore-node is configured: dashpay/dashcore-node, test_and_release.yml, no environment, npm publish allowed. It has to publish once before 2026-11-22 14:52 UTC or it must be re-created.

After merge

Publish GitHub release v7.0.7 from master, then check npm view @dashevo/dashcore-node version and the provenance on npmjs.com. The release job does not run in PR CI, so the release is its first run.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Release
    • Updated the package to version 7.0.7.
    • Development releases are published under version-specific tags, while other releases use the latest tag. Release tags must match the package version.
  • Chores
    • Updated package repository metadata to point to the current HTTPS repository address.
    • Streamlined package publishing and removed reliance on a stored npm token.

shumkov and others added 2 commits November 20, 2026 21:31
The release job published with the org NPM_TOKEN secret, which npm now
rejects (E404 on PUT for 7.0.6). The job now authenticates with npm
trusted publishing: npm exchanges the job's GitHub OIDC token for a
short-lived publish token and adds a provenance attestation.

Same setup as dashpay/dashcore-lib#326: only GitHub's own actions,
pinned to commits, run in the job that holds id-token: write, the
tag checks are plain shell, and nothing is installed before publishing.
package.json's repository now names dashpay/dashcore-node, which
provenance requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7.0.6 never reached npm. 7.0.7 is the first release published with trusted publishing.

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

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The release job now uses npm trusted publishing, checks that the release tag matches the package version, and selects an npm distribution tag. The package version changes to 7.0.7, and the repository URL changes to an HTTPS Git URL under dashpay.

Changes: npm release

Layer / File(s) Summary
Release job setup
.github/workflows/test_and_release.yml
The release job adds read-only contents and OIDC permissions, pins its setup actions, and changes to Node.js 24.14.1. It removes npm caching and dependency installation.
Package version and release tags
package.json, .github/workflows/test_and_release.yml
The package version changes to 7.0.7, and the repository field changes to an HTTPS Git URL under dashpay. The workflow checks that the release tag matches the package version. Dev tags matching vMAJOR.MINOR receive the MAJOR.MINOR-dev npm tag; other tags receive latest.
npm publishing
.github/workflows/test_and_release.yml
The workflow replaces the npm-publish action and NPM_TOKEN with npm publish. It uses the selected tag, public access, disabled package scripts, and verbose logging.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant ReleaseJob as GitHub Actions release job
  participant PackageJson as package.json
  participant NpmRegistry as npm registry
  ReleaseJob->>PackageJson: Read package version
  ReleaseJob->>ReleaseJob: Validate release tag and select npm tag
  ReleaseJob->>NpmRegistry: Publish package with selected tag
Loading

Possibly related PRs

Suggested reviewers: strophy, pastapastapasta

Merge Risk: Minimal · up to a43d9

This change moves the release job from a rejected token to npm trusted publishing and bumps the version to 7.0.7. No concrete problems were found. The first real run will be the release itself, since the job does not run in PR CI.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "ci: publish to npm with trusted publishing (7.0.7)" matches the main change. The release job in test_and_release.yml switches from the NPM_TOKEN secret to npm trusted publishing with id-tok…
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.
Full details: Title check

Explanation

The title "ci: publish to npm with trusted publishing (7.0.7)" matches the main change. The release job in test_and_release.yml switches from the NPM_TOKEN secret to npm trusted publishing with id-token: write, and package.json bumps the version from 7.0.6 to 7.0.7. The title names the primary change and the version, so a teammate scanning history can identify it. It does not mention the repository URL change in package.json, which the title does not need to cover.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7d36bc08-ab1b-495c-9b0a-d6ab49b9c836
Commits

Reviewing files that changed from the base of the PR and between 6b16520 and a43d9ec.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 2

  • .github/workflows/test_and_release.yml
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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