Skip to content

Commit a960a2b

Browse files
Set up trusted publishing to npmjs.org (#13)
1 parent 0160206 commit a960a2b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ jobs:
118118
name: Publish to NpmJS.org
119119
needs: release
120120
runs-on: ubuntu-latest
121+
permissions:
122+
id-token: write # Required for OIDC
123+
contents: read
121124

122125
steps:
123126
- uses: actions/checkout@v4
@@ -127,6 +130,10 @@ jobs:
127130
node-version: '20'
128131
registry-url: 'https://registry.npmjs.org/'
129132

133+
# Ensure npm 11.5.1 or later is installed in order to npm OIDC to work
134+
- name: Update npm
135+
run: npm install -g npm@latest
136+
130137
# Sync package.json version with the git tag (strips the 'v' prefix)
131138
- name: Set version
132139
run: |
@@ -141,10 +148,8 @@ jobs:
141148
- name: Publish
142149
run: |
143150
if [[ "${GITHUB_REF_NAME}" == *"-alpha"* || "${GITHUB_REF_NAME}" == *"-beta"* || "${GITHUB_REF_NAME}" == *"-rc"* ]]; then
144-
npm publish --access public --tag next
151+
npm publish --tag next
145152
else
146-
npm publish --access public
153+
npm publish
147154
fi
148155
working-directory: MAKER.Npm
149-
env:
150-
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}

0 commit comments

Comments
 (0)