Repository navigation
WP-11508: Publish from a job that builds nothing, with npm trusted publishing - #900
Conversation
|
There was a problem hiding this comment.
🔵 Needs a closer look
Human verification is needed for the external main-only environment protection and all 47 npm trusted-publisher bindings, followed by validation of the first end-to-end OIDC publish and provenance on main.
No open issues 🎉
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
This PR separates package builds from npm publishing, limiting publishing permissions to a dedicated job that publishes prebuilt tarballs using npm trusted publishing.
Changes:
- Splits the release workflow into mode selection, versioning, packing, and publishing jobs with job-specific permissions.
- Removes static npm tokens, disables install scripts, and prevents checkouts from persisting credentials.
- Upgrades Changesets to 3.0.3, preserves private-package versioning, and removes obsolete publishing scripts.
| File | Description |
|---|---|
pnpm-lock.yaml |
Updates the Changesets dependency tree for version 3.0.3. |
package.json |
Upgrades Changesets and removes the former build-and-publish scripts. |
.github/workflows/publish.yml |
Separates release stages and enables trusted publishing of packed artifacts. |
.changeset/config.json |
Keeps private packages versioned without creating tags for them. |
Review effort: Balanced
…t-publish-job # Conflicts: # .github/workflows/publish.yml
96f4f85
into
main
General infos:
pnpm install --ignore-scripts): the 47 packages build,changeset publish-planandchangeset packselect and pack the four versions that are not on npm yet, andchangeset versionworks with the updated config. The workflow itself only runs onmain, so its four jobs are first exercised by the push that merges this PR.npm-publishenvironment, the npm trusted publishers and the retirement ofWORKLEAP_NPM_TOKENare settings, not code (see Before merging).WP-11508
Why?
The publish job ran the dependency install,
changeset version, the whole package build andlerna publishin the one job that held the npm publishing token and a write-scopedGITHUB_TOKEN. Every build-time dependency could read both. The token was long-lived, readable from a workflow run on any branch, and the published packages carried no provenance.What changed?
publish.yml: split into four jobs with thechangesets/actionv2 sub-actions, the layoutwl-squidealready uses.select-modecontents: readversion,publishandnoneversioncontents: write,pull-requests: writepackcontents: readpublishpackid-token: write,contents: readNo static npm token:
WORKLEAP_NPM_TOKEN,NPM_TOKENandNODE_AUTH_TOKENare gone from the workflow. Thepublishjob uses npm trusted publishing, in thenpm-publishenvironment, so published versions carry provenance.Installs and checkouts: every install runs with
--ignore-scripts, and every checkout setspersist-credentials: false.@changesets/cli2.25.0 → 3.0.3: the v2 sub-actions require Changesets 3. The lockfile change is limited to the Changesets dependency tree..changeset/config.json:privatePackages: { version: true, tag: false }. Changesets 3 no longer versions private packages by default, andwebsiteand@shared/componentshave changelogs.package.json: removedprepublish-ciandpublish-ci. The build they ran now runs in thepackjob, andlerna publishis no longer used.Before merging
The
publishjob fails until both settings exist:npm-publishenvironment in the repository settings, withmainas its only deployment branch. GitHub creates a missing environment without any protection.@igloo-ui/*packages: repositoryworkleap/ov-igloo-ui, workflowpublish.yml, environmentnpm-publish.After the first green publish, revoke
WORKLEAP_NPM_TOKENor remove this repository's access to it.Other Notes
main: two runs of this workflow ended withlerna ERR! E404at the publish step. Since chore(deps): update github pipeline dependencies (major) #899 movedchangesets/actionto v2.1.2, it fails earlier: v2 requires Changesets CLI 3 and renamed the inputs the old workflow passes. This PR brings both.@igloo-ui/metric@1.0.1,@igloo-ui/stepper@0.7.1,@igloo-ui/tag-picker@0.17.1and@igloo-ui/text-editor@1.0.1are versioned onmainbut not on npm. The first green run of this workflow publishes them.publishjob, which keeps it atcontents: read.publish.ymlor thenpm-publishenvironment: the npm trusted publisher of every package is bound to both names.publishjob can request the npm publishing token.changeset versionexits with code 1 when no changeset is pending, and a peer dependency bump now bumps dependents bypatchinstead ofmajor.🤖 Generated with Claude Code