Repository navigation
chore(release): stage the wrapper packages in the Rust release workflow - #12804
Conversation
The Rust release workflow authenticated every publish via npm trusted publishing, but npm allows a single trusted publisher per package and `pnpm` / `@pnpm/exe` have theirs bound to release.yml (the v11 TS releases). The OIDC token exchange therefore returned 404, pnpm skipped OIDC, and the unauthenticated PUT failed with E404. Split the publish into two steps: 1. The `@pnpm/exe.<target>` natives are published only from this workflow, so they keep trusted publishing and go live directly. 2. The `pnpm` and `@pnpm/exe` wrappers are staged with `pnpm stage publish` using the static NPM_TOKEN. Nothing goes live from CI for those two names; a maintainer promotes them with `pnpm stage approve <stage-id> --otp`, which is where the proof-of-presence is consumed. Stage ids are teed into the job summary for the approver. The steps must stay separate because `pnpm publish` skips OIDC as soon as a static _authToken is configured (#11495). `--provenance` keeps working in both steps: it needs only the `id-token: write` OIDC token, not trusted publishing. `set -o pipefail` guards the tee pipe because the runner's default bash is -e without pipefail.
📝 WalkthroughWalkthroughThe pacquet npm release workflow is updated to publish native packages and ChangesPublish Workflow Split
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PublishJob
participant NpmRegistry
participant GITHUB_STEP_SUMMARY
PublishJob->>NpmRegistry: Publish pacquet/npm/pacquet-* via trusted publishing (OIDC, provenance)
PublishJob->>PublishJob: Set npm auth token from NPM_TOKEN
PublishJob->>NpmRegistry: pnpm stage publish for pacquet/npm/pnpm*
NpmRegistry-->>PublishJob: Stage output (stage ids)
PublishJob->>GITHUB_STEP_SUMMARY: Append stage output
PublishJob->>PublishJob: Delete npm auth token (trap on exit)
Possibly related PRs
Suggested labels: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoFix Rust release workflow by staging wrapper packages and OIDC-publishing natives
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Dispatch exposes NPM token
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/pacquet-release-to-npm.yml (1)
245-247: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional:
teeonly captures stdout — stage IDs on stderr won't reach the summary.
| tee -a "$GITHUB_STEP_SUMMARY"forwards stdout only. Ifpnpm stage publishwrites the stage id (or human-readable status) to stderr, the job summary the approver relies on will be empty. If unsure of the output stream, redirect stderr as well.♻️ Capture both streams into the summary
- pnpm stage publish "$package/" --tag "$TAG" --access public --provenance --no-git-checks | tee -a "$GITHUB_STEP_SUMMARY" + pnpm stage publish "$package/" --tag "$TAG" --access public --provenance --no-git-checks 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"🤖 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/pacquet-release-to-npm.yml around lines 245 - 247, The job summary for the pnpm stage publish step may miss the stage ID because the current tee pipeline only captures stdout. Update the publish command in the workflow step that uses pnpm stage publish and tee so both stdout and stderr are written into GITHUB_STEP_SUMMARY, ensuring any stage ID or status emitted on stderr is preserved for the approver.
🤖 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.
Nitpick comments:
In @.github/workflows/pacquet-release-to-npm.yml:
- Around line 245-247: The job summary for the pnpm stage publish step may miss
the stage ID because the current tee pipeline only captures stdout. Update the
publish command in the workflow step that uses pnpm stage publish and tee so
both stdout and stderr are written into GITHUB_STEP_SUMMARY, ensuring any stage
ID or status emitted on stderr is preserved for the approver.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b9f4c395-4500-4a3e-95c7-f85c9bfc8a63
📒 Files selected for processing (1)
.github/workflows/pacquet-release-to-npm.yml
|
Code review by qodo was updated up to the latest commit f8cf86a |
…file pack hook (#12805) The beforePacking guard threw for any package named 'pnpm' that declares peerDependencies or optionalDependencies. From v12 the 'pnpm' name is the Rust wrapper, whose generated manifest intentionally declares optionalDependencies on the @pnpm/exe.<target> natives, so the guard broke the Rust release. The throw is redundant validation: the meta-updater config already deletes those fields from the CLI manifest, so meta-updater --test (run by lint in CI) rejects them before anything is packed. Keep only the genuinely pack-time part - stripping dependencies / devDependencies from the published manifest of the bundled TS CLI. The strip never touches optionalDependencies, so it behaves identically for every pnpm version and the v12 wrapper manifests pass through with their natives intact. Unblocks the staged wrapper publish in #12804.
Summary
The "Release pnpm (Rust)" workflow failed on its first publish attempt (run 28718351330): it authenticated everything via npm trusted publishing, but npm allows only one trusted publisher per package, and
pnpm/@pnpm/exealready have theirs bound torelease.yml(the v11 TS releases). The OIDC token exchange returned 404, pnpm skipped OIDC, and the unauthenticated PUT failed.This splits the publish step in two:
@pnpm/exe.<target>packages are published only by this workflow, so their trusted publishers can be pointed atpacquet-release-to-npm.yml(environmentrelease) without conflict. They go live directly.pnpmand@pnpm/exeare uploaded withpnpm stage publishusing the staticNPM_TOKEN. Nothing goes live from CI for those two names — a maintainer promotes them withpnpm stage approve <stage-id> --otp, which is where the proof-of-presence is consumed. The stage ids are teed into the job summary for the approver.--provenancekeeps working in both steps since it only needs theid-token: writeOIDC token, not trusted publishing. The steps must stay separate becausepnpm publishskips OIDC as soon as a static_authTokenis configured (#11495).set -o pipefailguards theteepipe because the runner's default bash is-ewithoutpipefail.Depends on #12805: the root
.pnpmfile.cjsbeforePackinghook currently rejects the v12 wrapper manifests (they intentionally declareoptionalDependencieson the natives); that PR version-gates the hook so they pass through untouched.Registry-side prerequisites (manual, not part of this PR): configure trusted publishers for the eight
@pnpm/exe.<target>packages against this workflow file, and ensureNPM_TOKENhas staged-publish rights onpnpmand@pnpm/exe.Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting.(CI-workflow-only change; no CLI code touched, nothing to port.)
pnpm changeset) if this PR changes any publishedpackage. (Not needed — no published package is changed.)
Written by an agent (Claude Code, claude-fable-5).