Skip to content

ci(pacquet): draft a GitHub release with install-script assets - #12907

Merged
zkochan merged 2 commits into
mainfrom
feat/v12-github-release-assets
Jul 10, 2026
Merged

zkochan merged 2 commits into
mainfrom
feat/v12-github-release-assets

Conversation

@zkochan

@zkochan zkochan commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

What

Publishes GitHub release assets from pacquet-release-to-npm.yml so get.pnpm.io's install scripts can install v12.

Why

The Rust pnpm releases publish to npm only — no git tag, no release assets. But install.sh / install.ps1 on get.pnpm.io download pnpm-<platform>-<arch>[-musl].tar.gz (.zip on Windows) from GitHub releases, so PNPM_VERSION=12.x currently 404s and surfaces as a generic "Install Error!". Publishing release assets under the existing v11 naming scheme makes the install scripts work for v12 with essentially no changes on the get.pnpm.io side (only the Intel-macOS guard needs to become v11-bound there, since the Rust build ships darwin-x64 again).

How

  • The build job's archives now ship under their final names: pnpm-<target>.tar.gz / .zip with a plain pnpm / pnpm.exe binary at the archive root — the exact layout the v11 releases use and the install scripts expect. (The pacquet bin is renamed at archive time; it's getting renamed to pnpm eventually anyway.)
  • A new github-release job (needs: build, publish) downloads the artifacts and drafts a v<version> release via softprops/action-gh-release — the same action and draft-first flow as the v11 pipeline in release.yml, so publishing the assets stays a deliberate maintainer action, mirroring the pnpm stage approve gate for the npm wrappers. The assets are uploaded byte-for-byte as attested in the build job — no repackaging. prerelease is derived from the version suffix, and make_latest: false prevents a published v12 prerelease from taking the "Latest" badge from the stable v11 line.
  • Since every archive now holds an identically-named binary, the publish job extracts each into a scratch dir and moves the binary out under its target-qualified name (pnpm-<target>[.exe]), which generate-packages.mjs now reads. This also drops the third-party montudor/action-zip action. The generated native package dirs keep the pacquet- prefix so they can't be caught by the pacquet/npm/pnpm* wrapper glob in the stage step.

Verified locally with mock binaries for all 8 targets, running the exact archive → extract → generate-packages.mjs chain: no binary clobbering across targets, each @pnpm/exe.<target> package gets its own binary, exec bits survive, and asset names match install.sh's asset_basename output exactly. Also confirmed the Rust CLI implements pnpm setup --force, which the install scripts run after extraction.

Notes

  • Install scripts can only fetch a given release once the draft is published.
  • v12 alphas released before this change have no GitHub release; the first release after merging is the first installable one.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added automated draft GitHub releases for platform-specific packages.
    • Updated release assets to use pnpm-friendly archive naming/layout for easier installation.
    • Added build provenance attestations to the platform release artifacts.
    • Releases are now marked as prereleases automatically when the version indicates a non-final build.
  • Build / Packaging
    • Improved per-platform native package generation to align binaries and generated package directories consistently.

The Rust pnpm releases only published to npm, so get.pnpm.io's
install.sh / install.ps1 — which download pnpm-<platform>-<arch>[-musl]
archives from GitHub releases — could not install v12 at all.

Add a github-release job that repackages the build artifacts under the
v11 asset naming scheme (binary renamed from pacquet-<target> to pnpm /
pnpm.exe at the archive root), attests them, and drafts a GitHub
release. Draft keeps publication a deliberate maintainer action, same
as the staged npm wrappers; make_latest: false keeps a v12 prerelease
from taking the "Latest" badge from the stable v11 line.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

CI: Draft GitHub releases with v11-style pnpm assets for v12 install scripts

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add a github-release job to draft a v GitHub release after npm publish.
• Repackage build artifacts to pnpm--[-musl] with pnpm/pnpm.exe at archive root.
• Attest repackaged assets and avoid Latest promotion for v12 prereleases.
Diagram

graph TD
  B["Build job"] --> A["binaries-* artifacts"] --> P["Publish to npm"]
  A --> G["GitHub release job"] --> R["Repackage assets"] --> T["Attest provenance"] --> D["Draft GitHub release"]
  P -.-> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Rename archives at build time to `pnpm-*`
  • ➕ Avoids repacking work and extra job runtime.
  • ➕ Single canonical artifact name used everywhere (npm + GitHub release).
  • ➖ Publish job currently expects pacquet-* names for extraction/package generation; changing build outputs would ripple through the pipeline.
  • ➖ Harder to keep a clear separation between internal build artifacts vs user-facing release assets.
2. Use `gh release create` + `gh release upload` instead of softprops
  • ➕ Fewer third-party actions; relies on GitHub CLI semantics.
  • ➕ Potentially simpler debugging (direct CLI output).
  • ➖ Requires installing/configuring gh and authentication nuances.
  • ➖ Softprops is already used for v11; matching it reduces behavioral drift.

Recommendation: Current approach is solid: keep build artifacts as-is for npm publishing, then generate user-facing GitHub assets in a dedicated job that can fail loudly if naming/layout is wrong. Reusing the same release action/draft-first workflow as v11 minimizes operational risk and keeps publishing gated by maintainers.

Files changed (1) +74 / -5

Other (1) +74 / -5
pacquet-release-to-npm.ymlAdd job to draft GitHub releases with install-script-compatible assets +74/-5

Add job to draft GitHub releases with install-script-compatible assets

• Extends the Rust pnpm release workflow with a 'github-release' job that runs after 'build' and 'publish'. The job downloads 'binaries-*' artifacts, repackages archives to the v11 naming/layout expected by get.pnpm.io install scripts, attests the repackaged assets, and drafts a GitHub release with 'make_latest: false' and prerelease detection based on the version suffix.

.github/workflows/pacquet-release-to-npm.yml

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1048063c-15f7-4a0e-9296-954cbde47dce

📥 Commits

Reviewing files that changed from the base of the PR and between a4c3484 and dc0c3db.

📒 Files selected for processing (2)
  • .github/workflows/pacquet-release-to-npm.yml
  • pacquet/npm/pnpm/scripts/generate-packages.mjs

📝 Walkthrough

Walkthrough

The release workflow packages platform binaries as pnpm-* archives, extracts them for native package generation, and drafts a versioned GitHub release. The package generator uses the updated extracted binary names and native package directory prefix.

Changes

Platform binary release

Layer / File(s) Summary
Package and extract platform binaries
.github/workflows/pacquet-release-to-npm.yml
Build artifacts are renamed and archived as pnpm-<target> files, attested using the new names, then extracted into target-qualified binaries for publishing.
Generate native packages and draft release
pacquet/npm/pnpm/scripts/generate-packages.mjs, .github/workflows/pacquet-release-to-npm.yml
Native packages use pacquet-<target> directories and pnpm-<target> source binaries; a draft, version-tagged GitHub release uploads the platform archives.

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

Sequence Diagram(s)

sequenceDiagram
  participant build as build job
  participant publish as publish job
  participant packages as package generation
  participant release as github-release job
  participant github as GitHub Releases
  build->>build: create pnpm-target archives
  build->>publish: upload binaries-target artifacts
  publish->>packages: provide target-qualified binaries
  build->>release: download binaries-target artifacts
  release->>github: create draft release and upload pnpm archives
Loading

Possibly related PRs

  • pnpm/pnpm#11652: Modifies the same workflow’s GitHub release behavior.
  • pnpm/pnpm#12804: Modifies the same publish pipeline and generated package publication flow.
  • pnpm/pnpm#12806: Modifies native package generation in the same script.

Suggested labels: product: pacquet

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v12-github-release-assets

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.

@qodo-code-review

qodo-code-review Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 51 rules

Grey Divider


Remediation recommended

1. Tag/source version mismatch 🐞 Bug ⛨ Security
Description
The workflow now creates a git tag v<version> on github.sha, but the release version is injected
into the Rust sources only during CI build, so the tagged commit’s checked-out sources can disagree
with the released version. This weakens traceability/provenance (audits/bisects against the tag
won’t reflect the version users installed) and makes rebuilds from the tag non-obvious without
reproducing the CI injection step.
Code

.github/workflows/pacquet-release-to-npm.yml[R355-356]

+          tag_name: v${{ inputs.version }}
+          target_commitish: ${{ github.sha }}
Evidence
The build job explicitly patches PACQUET_VERSION at runtime, while the new release step tags the
current commit SHA; defaults.rs states the committed version tracks a pre-release line and is
patched by the release workflow. Together, that means the new v<version> tag can point at sources
whose embedded version differs from <version>.

.github/workflows/pacquet-release-to-npm.yml[99-120]
.github/workflows/pacquet-release-to-npm.yml[350-358]
pacquet/crates/config/src/defaults.rs[248-254]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The workflow creates `tag_name: v${{ inputs.version }}` pointing at `${{ github.sha }}` while the actual version is injected into source at build time, meaning the tag may not reflect the released version in the repository tree.

### Issue Context
This mismatch is new/important because this PR introduces git tags/releases for the Rust line.

### Fix Focus Areas
- .github/workflows/pacquet-release-to-npm.yml[99-120]
- .github/workflows/pacquet-release-to-npm.yml[350-358]
- pacquet/crates/config/src/defaults.rs[248-254]

### Recommended fix
Add a guard step (before creating the release) that asserts the repository’s version source-of-truth already equals `inputs.version` (e.g., `grep -F 'pub const PACQUET_VERSION: &str = "'$VERSION'"' ...`), and fail if it doesn’t.

If you intentionally want CI-only version injection, document that tags do not correspond to versioned sources and consider tagging a versioned release commit instead (e.g., require a version-bump PR before running this workflow).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Overbroad job token scope ✓ Resolved 🐞 Bug ⛨ Security
Description
The new github-release job grants contents: write and id-token: write to the entire job,
including artifact download and archive unpack/repack steps. This increases blast radius
unnecessarily (any issue in those steps runs with release/tag write and OIDC-attestation capability)
and conflicts with the repo’s CI guidance to scope permissions to the exact step/job that needs
them.
Code

.github/workflows/pacquet-release-to-npm.yml[R298-336]

+    permissions:
+      contents: write # create the draft release and its tag
+      id-token: write # needed for actions/attest-build-provenance
+      attestations: write
+    needs:
+      - build
+      - publish
+    steps:
+      - name: Download Artifacts
+        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+        with:
+          pattern: binaries-*
+          merge-multiple: true
+
+      - name: Repackage archives for the install scripts
+        # get.pnpm.io's install.sh / install.ps1 download
+        # `pnpm-<platform>-<arch>[-musl].tar.gz` (`.zip` on Windows) from the
+        # GitHub release and expect a binary named `pnpm` / `pnpm.exe` at the
+        # archive root — the layout the v11 releases ship. The build job's
+        # archives carry the Cargo bin name (`pacquet-<target>`) inside, so
+        # rename while repacking. A missing or misnamed binary makes `tar`/`mv`
+        # fail and the job abort, which is what we want.
+        run: |
+          mkdir -p release-assets work
+          for archive in pacquet-*.tar.gz; do
+            target="${archive%.tar.gz}"; target="${target#pacquet-}"
+            rm -rf work && mkdir work
+            tar -xzf "$archive" -C work
+            mv "work/pacquet-$target" work/pnpm
+            chmod 755 work/pnpm
+            tar -czf "release-assets/pnpm-$target.tar.gz" -C work pnpm
+          done
+          for archive in pacquet-*.zip; do
+            target="${archive%.zip}"; target="${target#pacquet-}"
+            rm -rf work && mkdir work
+            unzip -q "$archive" -d work
+            mv "work/pacquet-$target.exe" work/pnpm.exe
+            (cd work && zip -q "../release-assets/pnpm-$target.zip" pnpm.exe)
+          done
Evidence
The workflow assigns elevated permissions at the job level, and then executes archive
extraction/repacking steps under those permissions; the repo review guide explicitly requires
minimizing token permissions and scoping them to the exact step/job that needs them.

.github/workflows/pacquet-release-to-npm.yml[295-336]
REVIEW_GUIDE.md[101-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The `github-release` job performs artifact handling while holding `contents: write` and `id-token: write`.

### Issue Context
Repo guidance explicitly calls out minimizing workflow token permissions and scoping credentials to the narrowest required surface.

### Fix Focus Areas
- .github/workflows/pacquet-release-to-npm.yml[295-343]
- REVIEW_GUIDE.md[101-103]

### Recommended fix
Split into two jobs:
1) `repackage-release-assets` (permissions: `contents: read` only): download artifacts, repackage into `release-assets/`, then upload `release-assets` as a new artifact.
2) `github-release` (permissions: `contents: write`, `id-token: write`, `attestations: write`): download the `release-assets` artifact, run `actions/attest-build-provenance`, then run `softprops/action-gh-release`.

This keeps archive handling off the job that can write tags/releases and request OIDC tokens.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 10, 2026
@qodo-code-review

qodo-code-review Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Enable nullglob for safer bash globbing

Enable shopt -s nullglob in the bash script to handle cases where globs don't
match any files.

.github/workflows/pacquet-release-to-npm.yml [321-323]

+shopt -s nullglob
 mkdir -p release-assets work
 for archive in pacquet-*.tar.gz; do
   target="${archive%.tar.gz}"; target="${target#pacquet-}"
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: Enabling nullglob prevents the bash script from incorrectly iterating over an unexpanded literal glob string if an archive type is missing, making the process more robust.

Low
  • More

Rename the build-job archives from pacquet-<target> to pnpm-<target>
with a plain pnpm / pnpm.exe binary at the archive root — the layout
the v11 releases use and the install scripts expect. The github-release
job now uploads the build artifacts byte-for-byte as attested, instead
of repackaging (and re-attesting) them.

Since every archive now holds an identically-named binary, the publish
job extracts each into a scratch dir and moves the binary out under its
target-qualified name (this also drops the third-party unzip action).
The generated native package dirs keep the pacquet- prefix so they
stay out of the pacquet/npm/pnpm* wrapper glob.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit dc0c3db

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

@zkochan
zkochan merged commit 7074b6b into main Jul 10, 2026
27 checks passed
@zkochan
zkochan deleted the feat/v12-github-release-assets branch July 10, 2026 14:38
zkochan added a commit to pnpm/get.pnpm.io that referenced this pull request Jul 10, 2026
* fix: limit the Intel macOS abort to pnpm v11

pnpm v12 (the Rust port) ships a working darwin-x64 binary again — the
Node.js SEA segfault that forced the guard only affects the v11 SEA
builds. Gate the abort on major == 11 so v12 installs proceed on Intel
Macs once the v12 GitHub releases carry the darwin-x64 asset
(pnpm/pnpm#12907).

Co-Authored-By: Claude Fable 5 <[email protected]>

* chore: sign

* fix: detect macOS in install.ps1 on PowerShell 7.6+

PowerShell 7.6 is built on .NET 10, where RuntimeInformation.OSDescription
on macOS returns "macOS <version>" instead of the Darwin kernel string,
so $PSVersionTable.OS no longer matches 'Darwin*'. The macOS 26 runner
images (macos-latest since 2026-06-15) ship pwsh 7.6, which made the
installer abort with "Platform could not be determined".

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Zoltan <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants