Commit a210b2a
authored
Fix npm publish workflow for trusted publishing (#143)
Cloeses o1-labs/o1js-site#3.
Sibling of PR #142.
## Summary
- Remove `registry-url` from `actions/setup-node`: it generates an
`.npmrc` that conflicts with npm's OIDC trusted publishing
authentication
- Add `--provenance` to `npm publish`: signs the package with a build
attestation linking it to this repo and workflow
- Add `workflow_dispatch` trigger: allows manual publishes from the
GitHub Actions UI
- NOTE:
- This PR does everything as PR [#142
](#142.). However #142
didn't add `--provenance`. Without it, the `id-token: write` permission
is set up but never actually used. The OIDC token gets requested but
`npm publish` doesn't attach it as a signed attestation to the package.
So it's a fix on top of what PR #142 had.
## Publishing process
### Pre-release steps
1. Bump the version in `package.json` (e.g. `npm version patch` /
`minor` / `major`)
2. Commit the version bump
3. Tag the commit: `git tag v<version>` (e.g. `git tag v0.1.0`)
4. Push both: `git push origin main --tags`
The workflow triggers automatically on the `v*` tag push. It will:
1. Install dependencies (`npm ci`)
2. Build the package (`npm run build`)
3. Run tests (`npm test`)
4. Publish to npm with provenance attestation
Alternatively, you can trigger the workflow manually from the [Actions
tab](../../actions/workflows/publish-npm.yml) using "Run workflow" on
any branch.
### Prerequisites
- npm trusted publishing must be configured for this package on
npmjs.com, linking it to this GitHub repo (already done by Leon)
- The version in `package.json` must not already be published on npm
## Test plan
- [ ] Trigger workflow manually via `workflow_dispatch` to verify it
authenticates and publishes correctly
- [ ] Verify the published package on `npmjs.com` shows provenance
information1 parent 40ec094 commit a210b2a
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
0 commit comments