Skip to content

ci: cut over release-please to Rust binary + npm trusted publishing#42

Merged
amondnet merged 3 commits into
mainfrom
ci/release-rust-npm-cutover
Jun 20, 2026
Merged

ci: cut over release-please to Rust binary + npm trusted publishing#42
amondnet merged 3 commits into
mainfrom
ci/release-rust-npm-cutover

Conversation

@amondnet

@amondnet amondnet commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-points the release pipeline from the deprecated TypeScript line to the actually-published artifact (npm/csp distributing the Rust binary), and fixes the first release version (currently resolving to 1.0.0 on #41).

Why 1.0.0 instead of 0.1.0

.release-please-manifest.json is 0.0.0, which release-please treats as a bootstrap state. On the first release it ignores bump-minor-pre-major / bump-patch-for-minor-pre-major and falls back to its default initial version (1.0.0). initial-version: 0.1.0 pins it.

Changes

  • release-please-config.json: initial-version: 0.1.0; extra-files now track npm/csp/package.json (json) + Cargo.toml (generic), dropping dead src/version.ts.
  • Cargo.toml: annotate [workspace.package] version for release-please bump (both crates use version.workspace = true).
  • package.json (root): private: true — prevents accidental publish of the unpublished TS package sharing the @pleaseai/csp name.
  • release-rust.yml: add workflow_call (reusable).
  • release-please.yml: replace TS bun build job with reusable Rust build (6 targets) + publish-npm job that runs generate-platform-packages.mjs and publishes via **npm Trusted Publishing (OIDC, no token, automatic provenance)`. Homebrew job depends on the Rust build.

Version flow (single line)

release-please 0.1.0 → Cargo workspace version (csp --version) → npm/csp + generated platform packages + optionalDependencies pins → GH release tag → Homebrew.

Verified locally with a dry-run of generate-platform-packages.mjs 0.1.0: 6 platform packages + wrapper all stamped 0.1.0, optionalDependencies pinned consistently.

⚠️ Before/after merge

  1. Configure npm Trusted Publisher for all 7 packages (@pleaseai/csp + 6 platform packages) on npmjs.com → Repository pleaseai/code-search, Workflow release-please.yml. Note the first-publish bootstrapping caveat for not-yet-existing package names.
  2. PR chore(main): release 0.1.0 #41 was generated with the old config. After this merges, release-please recomputes chore(main): release 0.1.0 #41 to 0.1.0 — merge that updated PR (do not merge chore(main): release 0.1.0 #41 as-is).

Test plan

  • JSON/YAML syntax validated
  • generate-platform-packages.mjs dry-run produces expected dist tree + version stamping
  • CI green on this PR

Summary by cubic

Cut over the release pipeline to build and ship the Rust binary and publish @pleaseai/csp via npm Trusted Publishing. Pins the first release to 0.1.0 and keeps versions aligned across Cargo and npm/csp.

  • Refactors

    • Replace the TS build with a reusable Rust build in release-rust.yml that cross-compiles 6 targets and uploads assets; expose workflow_call.
    • Add an npm publish job to generate per-platform packages from release assets and publish via Trusted Publishing (OIDC, no token or inherited secrets); upgrade npm and set checkout persist-credentials: false.
    • Make the Homebrew job depend on the Rust build/upload.
    • Configure release-please with initial-version: 0.1.0; track versions in npm/csp/package.json, Cargo.toml (annotated), and re-add src/version.ts; mark the root package.json as private.
  • Migration

    • Set up npm Trusted Publisher for @pleaseai/csp and all platform packages pointing to this repo and release-please.yml.
    • After merge, let release-please refresh PR chore(main): release 0.1.0 #41 to 0.1.0, then merge that updated PR.

Written for commit 92f504f. Summary will update on new commits.

Summary by CodeRabbit

  • Chores
    • Streamlined release automation by delegating Rust build-and-upload to a reusable workflow and updating the Homebrew formula update to depend on it.
    • Added automated npm publishing for per-platform and wrapper packages by downloading released binaries and publishing via identity-based trusted publishing (no manual token/provenance flags).
    • Updated release configuration to align versioning across Rust and npm, and marked the npm package as private.
  • Documentation
    • Clarified that the Rust build workflow supports both manual rebuilds and release-triggered reusable execution, including passing an optional release tag.

Re-point the release pipeline from the deprecated TypeScript line to the
actually-published artifact (`npm/csp` distributing the Rust binary), and
fix the first release version.

- release-please-config.json: pin first release via `initial-version: 0.1.0`
  (manifest is 0.0.0, so release-please ignored the pre-major bump flags and
  defaulted to 1.0.0); track the real sources via extra-files — npm/csp
  package.json (json) and Cargo.toml (generic), dropping the dead src/version.ts.
- Cargo.toml: annotate the workspace version line so release-please bumps it;
  both crates use version.workspace=true, so one line covers them.
- package.json (root): mark private to prevent accidental publish of the
  unpublished TS package that shares the @pleaseai/csp name.
- release-rust.yml: add workflow_call so it can be reused by the release pipeline.
- release-please.yml: replace the TS `bun build` job with a reusable Rust build
  (6 targets) + a publish-npm job that generates the per-platform packages and
  publishes them via npm Trusted Publishing (OIDC, no NPM_TOKEN; provenance
  automatic). Homebrew job now depends on the Rust build+upload.
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 84eed4ba-f090-4180-94c6-885833a2ecd0

📥 Commits

Reviewing files that changed from the base of the PR and between 4440780 and 92f504f.

📒 Files selected for processing (2)
  • .github/workflows/release-please.yml
  • release-please-config.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • release-please-config.json
  • .github/workflows/release-please.yml

📝 Walkthrough

Walkthrough

The release pipeline is refactored: release-rust.yml gains a workflow_call trigger so release-please.yml can delegate Rust builds to it. A new publish-npm job in release-please.yml downloads release assets and publishes platform and wrapper npm packages via OIDC Trusted Publishing. Version tracking in Cargo.toml, package.json, and release-please-config.json is aligned.

Changes

Release Pipeline Refactor

Layer / File(s) Summary
Version markers and release-please config
Cargo.toml, package.json, release-please-config.json
Adds # x-release-please-version to Cargo.toml, marks root package.json as private: true, sets initial-version: 0.1.0, and updates extra-files to track versions in npm/csp/package.json and Cargo.toml.
release-rust.yml workflow_call interface
.github/workflows/release-rust.yml
Adds a workflow_call trigger with an optional tag input and updates comments to document manual and reusable invocation modes, enabling release-please.yml to call this workflow on release creation.
release-please.yml orchestration and npm publish
.github/workflows/release-please.yml
Replaces the inline Rust build/upload logic with a build-and-upload job that calls release-rust.yml; adds a publish-npm job that downloads release assets, generates per-platform npm packages, and publishes them via OIDC Trusted Publishing; updates update-homebrew-formula to depend on build-and-upload.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Hop hop, the pipeline's neat,
Reusable workflows make it sweet.
No NPM_TOKEN needed here,
OIDC magic makes it clear.
The bunny ships to npm with glee —
Release automation, wild and free! 🚀

🚥 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 'ci: cut over release-please to Rust binary + npm trusted publishing' accurately and concisely summarizes the main change: transitioning the release pipeline from TypeScript to a Rust binary with 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/release-rust-npm-cutover

Comment @coderabbitai help to get the list of available commands and usage tips.

@amondnet amondnet self-assigned this Jun 20, 2026

@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 configures release-please by marking the package as private, setting an initial version, and updating the tracked extra-files. The review feedback highlights that src/version.ts was removed from the release configuration but still exists in the repository, which could lead to version mismatches if it is still active.

Comment thread release-please-config.json
@codacy-production

codacy-production Bot commented Jun 20, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

eslint yaml/plain-scalar flagged the quoted description on the reused
workflow_call input.
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cubic-dev-ai cubic-dev-ai 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.

1 issue found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread release-please-config.json

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

🤖 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-please.yml:
- Around line 92-94: The actions/checkout action in the publish job is using
default settings which persist Git credentials, creating unnecessary security
exposure. Modify the checkout step (the one at lines 92-94 with
actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5) by adding a with
parameter to explicitly disable credential persistence with persist-credentials:
false, since this job does not perform any git push operations.
- Around line 73-77: The workflow call to release-rust.yml uses `secrets:
inherit` which passes all available secrets to the called workflow, violating
least-privilege principles. Replace `secrets: inherit` with an explicit secrets
mapping that only passes the GITHUB_TOKEN secret that is actually needed for the
release job, similar to how `secrets: { GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }
}` would restrict access to only what is required.
🪄 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 Plus

Run ID: c969862e-96d1-4cb6-896a-9c038add038d

📥 Commits

Reviewing files that changed from the base of the PR and between 3b47fb5 and 0067885.

📒 Files selected for processing (5)
  • .github/workflows/release-please.yml
  • .github/workflows/release-rust.yml
  • Cargo.toml
  • package.json
  • release-please-config.json

Comment thread .github/workflows/release-please.yml
Comment thread .github/workflows/release-please.yml
- re-add src/version.ts to extra-files (still imported by src/cli.ts +
  src/index.ts; would otherwise freeze at 0.0.0) — gemini, cubic
- drop secrets: inherit from the reusable workflow call (github.token is
  available without it; least-privilege) — coderabbit
- set persist-credentials: false on the publish-npm checkout (read+publish
  only, never pushes) — coderabbit
@amondnet amondnet merged commit d69d2f7 into main Jun 20, 2026
9 checks passed
@amondnet amondnet deleted the ci/release-rust-npm-cutover branch June 20, 2026 14:38
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