Skip to content

Commit fa5e586

Browse files
authored
feat: use npm trusted publishing instead of NPM_TOKEN (#678)
1 parent dbe8fab commit fa5e586

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

.github/workflows/napi.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ jobs:
453453
uses: actions/setup-node@v4
454454
with:
455455
node-version: 20
456+
registry-url: 'https://registry.npmjs.org'
457+
- name: Update npm for trusted publishing support
458+
run: npm i -g npm@11.6.1
456459
- name: Install dependencies
457460
run: npm install --ignore-scripts
458461
working-directory: ${{ env.WORKING_DIR }}
@@ -485,17 +488,14 @@ jobs:
485488
- name: Publish
486489
if: steps.version_check.outputs.should_publish == 'true' || github.event.inputs.publish == 'true'
487490
run: |
488-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
489-
npm config set provenance true
490491
LOCAL_VERSION="${{ steps.version_check.outputs.local_version }}"
491492
if echo "$LOCAL_VERSION" | grep -q "-"; then
492493
echo "Publishing $LOCAL_VERSION as next"
493-
npm publish --tag next --access public
494+
npm publish --tag next --access public --provenance
494495
else
495496
echo "Publishing $LOCAL_VERSION as latest"
496-
npm publish --access public
497+
npm publish --access public --provenance
497498
fi
498499
working-directory: ${{ env.WORKING_DIR }}
499500
env:
500501
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
501-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)