Skip to content

Instantly share code, notes, and snippets.

@jaywcjlove
Last active April 27, 2026 12:55
Show Gist options
  • Select an option

  • Save jaywcjlove/a178278521a6f72c74525d3f1d9c4bf9 to your computer and use it in GitHub Desktop.

Select an option

Save jaywcjlove/a178278521a6f72c74525d3f1d9c4bf9 to your computer and use it in GitHub Desktop.

NPM publish using OIDC on github actions

➊ NPM Settings

NPM Settings

➋ Github Action Settings

Github Action Settings

.github/workflows/ci.yml

.github/workflows/ci.yml

➍ Proper permissions are required.

permissions:
  contents: write
  id-token: write

Complete configuration

jobs:
  npm-publish:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
      
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          registry-url: 'https://registry.npmjs.org'

      # npm@v11.5.0+ is required for OIDC support
      # node@v22.0.0+ 
      # - name: Upgrade npm for OIDC support
      #   run: npm install -g npm@latest
      
      # node@v24.0.0+ 
      # https://github.com/orgs/community/discussions/176761
      # https://github.com/actions/setup-node/issues/1440#issuecomment-3571890875
      - run: NODE_AUTH_TOKEN="" npm publish --access public --provenance
        name: 📦 hotkeys-js to NPM
        continue-on-error: true
@Heihokon

Copy link
Copy Markdown

Thanks for the guide. It finally helped me fix my OIDC issue 🎉
This should really be in npm’s troubleshooting section.

@rajbos

rajbos commented Mar 20, 2026

Copy link
Copy Markdown

The NODE_AUTH_TOKEN="" did the trick for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment