Skip to content

Commit a640b3e

Browse files
authored
Merge pull request #1 from github/publish-workflow
Actions workflow to publish to npm
2 parents 163c39f + 64bbb03 commit a640b3e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
publish-npm:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
registry-url: https://registry.npmjs.org/
20+
cache: npm
21+
- run: npm ci
22+
- run: npm test
23+
- run: |
24+
echo "Publishing $TAG_NAME"
25+
npm version ${TAG_NAME} --git-tag-version=false
26+
env:
27+
TAG_NAME: ${{github.event.release.tag_name}}
28+
- run: npm whoami; npm publish --provenance --access public
29+
env:
30+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)