Skip to content

Switch npm publish to OIDC Trusted Publisher#31

Open
lukaskroepfl wants to merge 1 commit into
mainfrom
chore/oidc-npm-publish
Open

Switch npm publish to OIDC Trusted Publisher#31
lukaskroepfl wants to merge 1 commit into
mainfrom
chore/oidc-npm-publish

Conversation

@lukaskroepfl

Copy link
Copy Markdown
Member

Summary

The @bitmovin/cli package is now configured with an npm Trusted Publisher binding to bitmovin/cli :: pack.yml (OIDC). This PR makes pack.yml actually use that — switching from the long-lived NPM_TOKEN granular token to short-lived OIDC tokens minted by GitHub Actions.

Changes

  • pack.yml :: publish-npm
    • permissions.id-token: write so the workflow can mint an OIDC token for the npm registry to verify against the Trusted Publisher binding.
    • Dropped NODE_AUTH_TOKEN: secrets.NPM_TOKEN and setup-node's registry-url: — no .npmrc auth token needed under OIDC.
    • npm install -g npm@latest — Node 20 ships an npm older than the 11.5.1 needed for Trusted Publisher support.
    • npm publish --provenance --access public for sigstore-attested provenance.
  • Deleted .github/workflows/check-npm-token.yml and .github/npm-token-expiry.txt. The daily rotation-reminder workflow and the expiry tracker are obsolete once tokens are ephemeral.

Manual follow-ups (post-merge)

  • Delete the NPM_TOKEN repo secret in Settings → Secrets and variables → Actions.
  • Revoke the legacy granular token on npmjs.com.

Test plan

  • Next v* tag push: the publish-npm job authenticates via OIDC and publishes @bitmovin/cli to npm with provenance (visible on the package page on npmjs.com).
  • No NPM_TOKEN reference anywhere in the workflows (grep clean).

The @bitmovin/cli npm package is now configured with a Trusted Publisher
binding to bitmovin/cli :: pack.yml (OIDC). Replace the long-lived NPM_TOKEN
auth on the publish-npm job with the OIDC flow:

- Add permissions: id-token: write so the workflow can mint an OIDC token
- Drop NODE_AUTH_TOKEN and setup-node's registry-url (no .npmrc auth needed)
- Upgrade npm to >= 11.5.1 (Node 20 ships with an older npm)
- Publish with --provenance for sigstore-attested provenance

Also remove the daily NPM_TOKEN expiry-check workflow and the expiry tracker
file — neither is needed with ephemeral OIDC tokens.

Manual follow-ups for a maintainer:
- Delete the NPM_TOKEN repo secret
- Revoke the legacy granular token on npmjs.com

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lukaskroepfl lukaskroepfl requested a review from mateun May 29, 2026 07:58
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