Skip to content

Commit bd9a0b0

Browse files
setup trusted-publishers
1 parent a007db7 commit bd9a0b0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010

1111
run-name: "Release: ${{ inputs.version }}"
1212

13+
permissions:
14+
contents: read
15+
id-token: write # Required for npm trusted publishing
16+
1317
env:
1418
DEBUG: napi:*
1519
APP_NAME: atlas-local
@@ -184,6 +188,10 @@ jobs:
184188
with:
185189
node-version: 22
186190
cache: yarn
191+
# Ensure npm 11.5.1 or later is installed
192+
# Required for trusted publishing: https://docs.npmjs.com/trusted-publishers
193+
- name: Update npm
194+
run: npm install -g npm@latest
187195
- name: Install dependencies
188196
run: yarn install
189197
- name: Create npm dirs
@@ -219,18 +227,14 @@ jobs:
219227
if echo "$COMMIT_MSG" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" > /dev/null;
220228
then
221229
echo "Publishing stable release to latest tag"
222-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
223230
npm publish --access public
224231
elif echo "$COMMIT_MSG" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+" > /dev/null;
225232
then
226233
echo "Publishing pre-release to next tag"
227-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
228234
npm publish --tag next --access public
229235
else
230236
echo "Invalid release tag format: '$COMMIT_MSG'"
231237
echo "Expected format: X.Y.Z or X.Y.Z-suffix"
232238
echo "Skipping publish"
233239
exit 0
234240
fi
235-
env:
236-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)