Skip to content

ci(release): switch publish to npm Trusted Publishing (OIDC)#97

Merged
salishforge merged 1 commit into
mainfrom
ci/trusted-publishing
Apr 18, 2026
Merged

ci(release): switch publish to npm Trusted Publishing (OIDC)#97
salishforge merged 1 commit into
mainfrom
ci/trusted-publishing

Conversation

@salishforge
Copy link
Copy Markdown
Owner

Summary

Removes `NODE_AUTH_TOKEN` from the publish step so `npm publish` authenticates via the GitHub Actions OIDC token. The `id-token: write` permission was already granted for provenance attestations; Trusted Publishing reuses that same OIDC token.

Prerequisite (one-time, on npm.com)

Before merging this PR, a trusted publisher must be configured for `@salishforge/memforge`:

  1. https://www.npmjs.com/package/@salishforge/memforge/accessTrusted publishersAdd
  2. Publisher type: GitHub Actions
  3. Organization: `salishforge` · Repository: `memforge` · Workflow filename: `release.yml` · Environment: (blank)

If this is not configured before merging, the next release tag will fail to publish (beta.3 is already shipped so nothing is at risk until beta.4).

Why

  • No token to rotate or leak; no 2FA bypass flag required.
  • Cryptographic proof (provenance attestation) that the publish came from this specific repo + workflow.
  • Aligns with npm's stated direction (classic Automation tokens are being phased out).

Follow-up (after merge + first successful OIDC publish)

Test plan

  • CI passes on this PR (no auth change — the publish step only runs on tag push, not PR)
  • Trusted publisher configured on npm.com BEFORE the next release tag
  • On next tag push, publish step runs without `NODE_AUTH_TOKEN` and succeeds

Remove NODE_AUTH_TOKEN from the publish step. With a trusted publisher
configured on npmjs.com for @salishforge/memforge + this workflow, the
npm CLI authenticates via the GitHub Actions OIDC token (id-token:
write was already granted for provenance attestations).

Benefits over a long-lived token:
- No secret to rotate or leak; no 2FA bypass flag required.
- Cryptographic proof that the publish came from this specific
  workflow in this specific repository.
- Aligns with npm's recommended practice (classic Automation tokens
  are being phased out).

Requires the trusted publisher to be configured on npmjs.com BEFORE
the next release tag is pushed. Once confirmed working, the NPM_TOKEN
secret can be deleted from the repo.
@salishforge salishforge merged commit 8874bf1 into main Apr 18, 2026
12 checks passed
@salishforge salishforge deleted the ci/trusted-publishing branch April 18, 2026 03:02
salishforge pushed a commit that referenced this pull request Apr 18, 2026
Ships Phase 2 of the ROADMAP (memory namespaces #16, cold tier search
+ restoration #14, memory budgeting, adaptive sleep advisory) and
closes out related tracker issues.

Also fixes #95: schema.sql no longer issues failing CREATE INDEX
statements for HNSW on bare halfvec columns (pgvector requires an
explicit dimension spec). The two affected indexes are now documented
in a new schema/hnsw-indexes.example.sql template that operators
apply AFTER choosing their embedding provider's dimension. Fresh
installs without embeddings emit no errors; installs with embeddings
get a clear, idempotent path to the HNSW indexes.

This is the first release publishing via npm Trusted Publishing (OIDC)
instead of a long-lived token — validates the infrastructure landed in
Sprint A and the Phase 2 follow-up (PR #97).

Changes bundled:
- package.json: 3.0.0-beta.3 → 3.0.0-beta.4
- CHANGELOG.md: new v3.0.0-beta.4 entry with per-feature and
  known-gap breakdown
- ROADMAP.md: "Where We Are Today" updated; Phase 1 "Remaining"
  section collapsed (all shipped); Phase 2 marked COMPLETE with
  per-item PR references; #13 two-pass triage flagged as the one
  partial item
- schema/schema.sql: remove two failing HNSW CREATE INDEX (with
  documented why-comment pointing at the template)
- schema/hnsw-indexes.example.sql: new — template for operators to
  apply HNSW indexes after pinning halfvec dimension
salishforge pushed a commit that referenced this pull request Apr 18, 2026
The v3.0.0-beta.4 release attempt failed despite a correctly configured
npm Trusted Publisher. Diagnosis: npm Trusted Publishing requires
npm >= 11.5.1, but the bundled npm with Node 22 on GitHub runners is
10.x — the OIDC publish flow is silently unsupported, and auth falls
through to NODE_AUTH_TOKEN (which we had removed in PR #97, producing
the 404 publish failure we observed).

Fix:
- Add `npm install -g npm@latest` before publish so the runner always
  has a TP-capable npm.
- Reinstate NODE_AUTH_TOKEN as a belt-and-suspenders fallback so the
  release pipeline isn't single-sourced on OIDC while we gain confidence
  in it. If OIDC works (expected now that npm is current), the token
  is ignored; if OIDC fails for any reason, the token keeps us shipping.

The NPM_TOKEN secret can be removed after OIDC ships a few releases
successfully. The comment in release.yml documents this explicitly.
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