ci: separate build and publish jobs and pin release actions
Splits the release workflows into build and publish jobs, pins every action by commit SHA, and tightens workflow token permissions.
- npm publish (
publish.yml): thebuildjob (read-only token, no secrets) installs, builds and packs the tarball; thepublishjob runs in thereleaseenvironment onmainonly and uploads that tarball with provenance through Trusted Publishing. Therelease: createdtrigger is removed so publishing has one path, the existing version-bump-on-mainflow (see below). - Binaries (
release-binaries.yml): build jobs get a read-only token instead ofcontents: write, andbun installruns with--ignore-scripts. A newpackagejob (read-only token) builds the Linux packages and checksums, including on dry runs; thereleasejob that holdscontents: writeruns only onmainfor a real release, in thereleaseenvironment, and attaches build provenance attestations to every asset. Packaging installs a pinned nfpm verified against its published SHA-256 instead of whatever is latest. - All workflows:
permissions: {}at the top with per-job grants, actions pinned by SHA, checkouts without persisted credentials where nothing is pushed. - pnpm:
packageManagermoves to pnpm 10.34.7, and a newpnpm-workspace.yamlsets an explicit build-script allowlist (allowBuilds, nothing allowed to run) and a three-dayminimumReleaseAgefor newly resolved dependencies, with the SDK excluded so its releases can be adopted the same day.pnpm install --frozen-lockfilepasses against the existing lockfile.
Trigger: publishing stays on version bumps merged to main, which release-binaries.yml already turns into a v* tag and GitHub release. Moving publishing onto tags would make one workflow depend on a tag another workflow pushes with GITHUB_TOKEN, which GitHub does not use to start workflows, so it would silently stop publishing. The release environment's main-only branch policy and the github.ref guard restrict where publishing can run.
Before merging: create the release environment with a deployment branch policy of main.
Summary by cubic
Splits npm publishing and binary releases into separate build and publish jobs, pins all GitHub Actions by commit SHA, and reduces workflow token permissions across the repo.
- npm publishing: the
buildjob installs, packs, and uploads the tarball with a read-only token; thepublishjob runs in a newreleaseenvironment onmainonly and uploads that tarball with npm provenance. Therelease: createdtrigger is removed so version bumps onmainbecome the single publishing path. Before merging, create thereleaseenvironment with a deployment branch policy ofmain. - Binaries: build jobs use read-only tokens and
bun installruns with--ignore-scripts; the unprivilegedpackagejob assembles tar, zip, and Linux package assets, including dry-run packaging. A separatereleasejob, gated tomainin thereleaseenvironment, creates the tag and release, installs nfpm pinned and verified by SHA-256 instead of latest, and attaches build provenance attestations to every release asset. - Hardening: all workflows declare
permissions: {}at the top with per-job grants, checkouts don't persist credentials where nothing is pushed, and actions are pinned by commit SHA. - Dependencies: pnpm moves to 10.34.7, and a new
pnpm-workspace.yamlsets anallowBuildsallowlist (nothing allowed) plus a three-dayminimumReleaseAgefor new dependencies, withfirecrawlexcluded.