Skip to content

ci: switch release workflow to npm Trusted Publishing - #9

Merged
mangelsnc merged 1 commit into
developfrom
fix/trusted-publishing
Jun 15, 2026
Merged

mangelsnc merged 1 commit into
developfrom
fix/trusted-publishing

Conversation

@mangelsnc

Copy link
Copy Markdown
Owner

Context

The v2.3.0 release failed at npm publish because the long-lived NPM_TOKEN is no longer valid. npm now recommends Trusted Publishing (OIDC) for CI/CD, which removes the need for any long-lived token.

The tag v2.3.0 and the GitHub Release for v2.3.0 were already created in the original release run, so this PR keeps them intact and only fixes the publish path.

Changes

  • Runner bumped to Node 20 (only in release.yml; ci.yml keeps Node 16 since it doesn't publish). npm 10 is required for OIDC and --provenance.
  • permissions: id-token: write added so the workflow can request the OIDC token from GitHub.
  • NODE_AUTH_TOKEN removed; npm publish now uses Trusted Publishing.
  • --provenance --access public added to the publish command.
  • New workflow_dispatch trigger with a force_publish boolean input. When force_publish=true, install/lint/test/build/publish run even if the tag already exists; tag and GitHub Release creation steps still only run when the tag does not exist. This is the recovery path for v2.3.0 and for any similar failure in the future.

Recovery plan

  1. Merge this PR into develop.
  2. Open develop → main, merge it. The push to main will run the workflow, see v2.3.0 tag already exists, and skip everything (baseline run of the new workflow).
  3. Manually trigger: gh workflow run release.yml -f force_publish=true (or via the Actions UI). With force_publish=true, the workflow will install/build and npm publish v2.3.0 to npm with provenance.
  4. Verify npm view undisclosed@2.3.0 version returns 2.3.0.

Test plan

  • CI on this PR passes (ci.yml still on Node 16).
  • After merge to main, the automatic push-trigger run skips publish (tag exists, no force_publish).
  • Manual dispatch with force_publish=true publishes v2.3.0 to npm successfully with provenance.

- Bump runner to Node 20 (npm 10 required for OIDC and --provenance).
- Add id-token: write permission so the workflow can request an OIDC token.
- Drop NODE_AUTH_TOKEN; npm publish authenticates via Trusted Publishing.
- Add --provenance --access public to the publish step.
- Add workflow_dispatch with a force_publish input to re-publish a version
  without re-tagging (needed to recover from a failed publish like v2.3.0).
@mangelsnc
mangelsnc merged commit b9d5fe5 into develop Jun 15, 2026
1 check passed
@mangelsnc
mangelsnc deleted the fix/trusted-publishing branch June 15, 2026 18:26
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