Skip to content

Commit 8b4bebd

Browse files
committed
feat: update new method for publishing to npm
1 parent 2a40cab commit 8b4bebd

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

.github/workflows/nodejs.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
- '*.js'
88
- '*.json'
99
- '.github/workflows/*'
10+
tags:
11+
- 'v*'
12+
13+
permissions:
14+
id-token: write # Required for OIDC
15+
contents: read
1016

1117
jobs:
1218
build:
@@ -26,18 +32,15 @@ jobs:
2632
npm run test
2733
2834
publish:
29-
needs: build
3035
runs-on: ubuntu-latest
36+
if: startsWith(github.ref, 'refs/tags/v')
3137
steps:
32-
- uses: actions/checkout@v1
33-
- uses: actions/setup-node@v1
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
3440
with:
35-
node-version: 12
36-
registry-url: https://registry.npmjs.org/
37-
- name: publish
38-
if: startsWith(github.ref, 'refs/tags/')
39-
run: |
40-
npm ci
41-
npm publish
42-
env:
43-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
41+
node-version: '24'
42+
registry-url: 'https://registry.npmjs.org'
43+
- run: npm ci
44+
- run: npm run build --if-present
45+
- run: npm test
46+
- run: npm publish

0 commit comments

Comments
 (0)