Skip to content

Publish npm packages via npm Trusted Publishing (no NPM_TOKEN) - #28

Merged
rrohitramsen merged 1 commit into
mainfrom
npm-trusted-publishing
Oct 20, 2026
Merged

rrohitramsen merged 1 commit into
mainfrom
npm-trusted-publishing

Conversation

@rrohitramsen

Copy link
Copy Markdown
Collaborator

The npm job of the v0.4.0-alpha release failed with E404 on publish because the NPM_TOKEN secret (last set April 2026) has expired. This PR switches npm publishing to npm Trusted Publishing, so no npm token is needed.

Changes (.github/workflows/publish.yml)

  • publish-npm gets id-token: write. npm verifies the GitHub OIDC token against each package's trusted-publisher settings (AgentTel/agenttel-sdk, publish.yml).
  • Uses Node 22 and npm 11, since trusted publishing needs npm 11.5.1 or newer.
  • No longer uses NODE_AUTH_TOKEN.
  • Each published version gets a provenance attestation automatically.
  • Passes --tag latest explicitly, because npm 11 requires a tag when publishing prerelease versions.
  • New workflow_dispatch trigger with a ref input that publishes npm only, using the code at a release tag. This lets 0.4.0 go out to npm without a new release; the Java and Python jobs are skipped on manual runs.

Before merging

  • On npmjs.com, add a trusted publisher to both @agenttel/node and @agenttel/types: GitHub Actions, AgentTel / agenttel-sdk, publish.yml, no environment.
  • Once 0.4.0 is on npm, delete the NPM_TOKEN secret.

After merging

Run Publish manually (Actions → Publish → Run workflow) from main with ref = v0.4.0-alpha. That publishes @agenttel/types@0.4.0-alpha.0 and @agenttel/node@0.4.0-alpha.0 from the release commit de83b6a.

actionlint reports no problems.

- publish-npm authenticates via GitHub OIDC (id-token: write) instead of
  the expired NPM_TOKEN secret; Node 22 + npm 11 (trusted publishing
  needs npm >= 11.5.1); provenance attestations come automatically
- explicit --tag latest (npm 11 requires a tag for prerelease versions)
- workflow_dispatch with a ref input re-publishes npm only, from a
  release tag, without re-running the Maven/PyPI jobs

Signed-off-by: Rohit Kumar <rrohit.ramsen@gmail.com>
@rrohitramsen
rrohitramsen merged commit 977fc80 into main Oct 20, 2026
9 checks passed
@rrohitramsen
rrohitramsen deleted the npm-trusted-publishing branch October 20, 2026 12:45
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