Skip to content

Commit c31c785

Browse files
authored
Merge pull request #85 from scheduleonce/update-npm-publish-workflow
Update npm-publish workflow
2 parents 508c710 + b3bc09a commit c31c785

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

.github/workflows/npm-publish.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
1-
# This workflow will publish a package to npm when a release is published
2-
# For more information, see https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
1+
# This workflow will run tests using node and then publish a package to npm when a release is created
2+
# For more information see:
3+
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
4+
# https://docs.npmjs.com/trusted-publishers
5+
6+
name: Node.js Package
37

4-
name: Publish Package to npmjs
58
on:
69
release:
710
types: [published]
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
816
jobs:
917
build:
1018
runs-on: ubuntu-latest
1119
steps:
1220
- uses: actions/checkout@v4
13-
# setup .npmrc file to publish to npm
14-
- uses: actions/setup-node@v3
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 24
24+
- run: npm ci
25+
- run: npm test
26+
27+
publish-npm:
28+
needs: build
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
1533
with:
16-
node-version: '18.x'
17-
registry-url: 'https://registry.npmjs.org'
34+
node-version: 24
35+
registry-url: https://registry.npmjs.org/
1836
- run: npm ci
19-
- run: npm run build:lib
2037
# scoped packages are private by default so need to add public flag
2138
- run: npm publish --access public
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)