Skip to content

Commit f4f0533

Browse files
committed
ci: support publishing without NPM tokens
1 parent a6b25a2 commit f4f0533

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/test-and-release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
- "v[0-9]+.[0-9]+.[0-9]+-**"
1616
pull_request: {}
1717

18+
permissions:
19+
id-token: write # Required for publishing with OICD
20+
contents: read # Required for creating releases
21+
1822
jobs:
1923
# Performs quick checks before the expensive test runs
2024
check-and-lint:
@@ -98,6 +102,10 @@ jobs:
98102
node-version: ${{ matrix.node-version }}
99103
cache: 'npm'
100104

105+
# Ensure npm 11.5.1 or later is installed
106+
- name: Update npm
107+
run: npm install -g npm@latest
108+
101109
- name: Extract the version and commit body from the tag
102110
id: extract_release
103111
# The body may be multiline, therefore we need to escape some characters
@@ -121,10 +129,7 @@ jobs:
121129
run: npm run build
122130

123131
- name: Publish package to npm
124-
run: |
125-
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
126-
npm whoami
127-
npm publish
132+
run: npm publish
128133

129134
- name: Create Github Release
130135
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)