ci: npm publish workflow via OIDC trusted publishing - #101
Conversation
Mirrors publish.yml (PyPI): manual workflow_dispatch, tag/version verification when dispatched on a v* tag, then npm publish with no long-lived token — authentication comes from the job's OIDC identity once a trusted publisher is configured for the package on npmjs.com. Requires npm >= 11.5.1, so the workflow updates the bundled npm.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A branch dispatch would let unreviewed code reach the registry; require a v* tag ref instead of skipping verification on non-tag refs.
|
Two hardenings followin: Hardened in Ask (@aswhitehouse): alongside the trusted-publisher setup, could you add Scott as a package owner once he has an npm account — |
… off tags npm/ has no Jest test files yet (the node runtime is certified via the conformance harness), so npm test exits 1 with 'No tests found' — typecheck with tsc --noEmit until tests land. Bring publish.yml to the same tag-only posture as npm-publish.yml: refuse non-v* refs instead of skipping verification.
|
Both issues taken, in 1. Chicken-and-egg — confirmed: 2. Minor — took the parity suggestion now rather than post-merge: |
|
Scott's npm account is live: npm owner add sgriffiths @prime-vector/open-agent-specFull checklist for closing out the 1.6.0 npm side (all yours, @aswhitehouse):
|
aswhitehouse
left a comment
There was a problem hiding this comment.
One compatibility fix is needed before this can publish through OIDC: the current npm trusted-publishing requirements are npm CLI >= 11.5.1 and Node >= 22.14.0, but this workflow pins Node 20. Updating npm globally does not satisfy the Node requirement. Please move the publish job to Node 22.14+ (preferably the current Node 24 example used by npm docs); while touching this, the official example now uses actions/setup-node@v6 and recommends package-manager-cache: false for release builds. The package repository URL already matches, permissions/environment/tag checks look sound, and CI is green.
Also, the one-time npm setup instructions should mention selecting the required allowed action npm publish: trusted-publisher configurations created after May 20, 2026 must explicitly select at least one allowed action. Once those are addressed, this looks ready.
OIDC trusted publishing requires Node >= 22.14 as well as npm >= 11.5.1; Node 20 fails the floor regardless of the npm upgrade. Follow the npm docs' current example: Node 24, setup-node@v6, package-manager-cache off so release builds never restore a stale dependency cache.
|
Both taken in
Ready for re-review. |
Both packages install a global oa; PATH order decides which runs. One line in the npm README so dual-installers aren't surprised.
|
Refinements from a second review pass (none blocking) — the earlier checklist had the trusted-publisher step too early, since this workflow file must exist on
Two honesty notes, actioned: the manual 1.6.0 npm artifact won't carry OIDC provenance attestations (unlike the PyPI 1.6.0 publish) — that's accepted for this one-shot and fixed from the next release. And the v1.6.0 GitHub release notes no longer say "one certified set": they now state each runtime is certified for the surface it implements, with npm explicitly refusing |
What changed
Adds
.github/workflows/npm-publish.yml— an npm publish workflow mirroring the PyPI one (publish.yml): manualworkflow_dispatch, tag ↔npm/package.jsonversion verification when dispatched on av*tag,npm ci+ tests, thennpm publishwith no long-lived token — auth comes from the job's OIDC identity via npm trusted publishing, which also generates provenance attestations automatically.prepublishOnlyalready runs the TypeScript build.Why
v1.6.0 is tagged and live on PyPI, but
@prime-vector/open-agent-specis still 1.5.1 on npm: the package has a single maintainer (@aswhitehouse) and publishing currently requires that personal login on a local machine. This puts npm releases on the same footing as PyPI — dispatched from CI against the tag, no secrets to rotate, provenance included.One-time setup needed (@aswhitehouse)
The workflow authenticates only after a trusted publisher is configured for the package (needs your npm login, ~2 minutes):
@prime-vector/open-agent-spec→ Settings → Trusted Publisher → GitHub Actionsprime-vector· Repository:open-agent-spec· Workflow filename:npm-publish.yml· Environment:npmnpm publish— configurations created after 2026-05-20 must explicitly allow at least one actionThen publish 1.6.0 by running the Publish to npm workflow from the Actions tab with
v1.6.0as the ref (orgh workflow run npm-publish.yml --ref v1.6.0).If you'd rather ship 1.6.0 immediately and set this up after, the manual path still works:
git checkout v1.6.0 && cd npm && npm ci && npm publishfrom your logged-in machine — this PR is about not needing that next time.How tested
pytest tests/) — workflow-only change, no runtime code touchedactionlint-style review by eye against the existingpublish.ymlstructure; the publish step itself is only exercisable once the trusted publisher exists (verification step and version check will fail fast if misconfigured).Type of change
Checklist