Skip to content

Migrate to OIDC on publishing npm packages in GitHub Actions #998

@legendecas

Description

@legendecas

See https://docs.npmjs.com/trusted-publishers for documentations.

Note

Trusted publishing requires npm CLI version 11.5.1 or later.

TL;DR: add the following section in the workflow file to replace ${secrets.NPM_TOKEN}, and create OICD connection on https://www.npmjs.com/package/<package-name>/access:

permissions:
  id-token: write  # Required for OIDC
  contents: read

This should help us get rid of npm tokens in GitHub Actions for publishing packages.

Quick search on npm token usages: https://github.com/search?q=org%3Anodejs+path%3A%22.github%2Fworkflows%22+%22npm+publish%22&type=code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions