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
@pcfreak30

Copy link
Copy Markdown

@jaywcjlove Something prob important for this guide that I found in trial error after a LOT of version git reverts.

The GitHub org name is case sensitive. My project is LumeWeb. I CANNOT use lumeweb in the repo config. I also had to set the repo url in all my package.json files...

Based on https://search.sigstore.dev/?logIndex=820957132, it seems everything gets hashed which would explain why the case sensitivity matters, but IMO this isn't well communicated and the DX def needs to improve 😅 . So hopefully me posting here help someone else as I just wasted nearly 4 hours on this issue...

@jaywcjlove

Copy link
Copy Markdown
Author

@jaywcjlove Something prob important for this guide that I found in trial error after a LOT of version git reverts.

The GitHub org name is case sensitive. My project is LumeWeb. I CANNOT use lumeweb in the repo config. I also had to set the repo url in all my package.json files...

Based on https://search.sigstore.dev/?logIndex=820957132, it seems everything gets hashed which would explain why the case sensitivity matters, but IMO this isn't well communicated and the DX def needs to improve 😅 . So hopefully me posting here help someone else as I just wasted nearly 4 hours on this issue...

@pcfreak30 Are you referring to the need to keep the repository name in npm consistent with the GitHub repository name? And also setting the repository in the project's package.json to match the name in both GitHub and npm configurations?

@pcfreak30

Copy link
Copy Markdown

@jaywcjlove Something prob important for this guide that I found in trial error after a LOT of version git reverts.
The GitHub org name is case sensitive. My project is LumeWeb. I CANNOT use lumeweb in the repo config. I also had to set the repo url in all my package.json files...
Based on https://search.sigstore.dev/?logIndex=820957132, it seems everything gets hashed which would explain why the case sensitivity matters, but IMO this isn't well communicated and the DX def needs to improve 😅 . So hopefully me posting here help someone else as I just wasted nearly 4 hours on this issue...

@pcfreak30 Are you referring to the need to keep the repository name in npm consistent with the GitHub repository name? And also setting the repository in the project's package.json to match the name in both GitHub and npm configurations?

Yes. Basically casing matters. I verified unintentionally by missing a package I forgot to update and it failed until i fixed the org name on the /access settings page in npmjs.com

@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