WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions ci/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
release:
types: [created]

permissions:
contents: read
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -27,7 +32,15 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/
# Ensure npm 11.5.1 or later is installed
- name: Update npm
run: npm install -g npm@latest
- run: npm ci
# It is recommended to publish to npm using trusted publishing; for
# details, see: https://docs.npmjs.com/trusted-publishers
- run: npm publish
Copy link
Contributor

@hashtagchris hashtagchris Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to leave the token commented out, as a fallback for GHES, and GHEC w/ data residency.

Suggested change
- run: npm publish
- run: npm publish
env:
# An explicit token is needed only for non-github.com workflows.
# NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a bare env: will cause an error, but I pushed up a riff on this suggestion.

env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
# If you are unable to use trusted publishing, you can uncomment the lines
# below to publish with a npm granular access token that you manage; for
# details, see: https://docs.npmjs.com/about-access-tokens
# env:
# NODE_AUTH_TOKEN: ${{secrets.npm_token}}