Skip to content

Commit 45b8a85

Browse files
committed
Add npm release workflow
1 parent 396140f commit 45b8a85

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish Release to npm
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
id-token: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: "20"
16+
registry-url: 'https://registry.npmjs.org'
17+
- run: npm install
18+
- run: npm test
19+
- if: ${{ github.event.release.tag_name != '' && env.NPM_PUBLISH_TAG != '' }}
20+
run: npm publish --provenance --access=public --tag=${{ env.NPM_PUBLISH_TAG }}
21+
env:
22+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23+
NPM_PUBLISH_TAG: ${{ contains(github.event.release.tag_name, '-beta.') && 'beta' || 'latest' }}

0 commit comments

Comments
 (0)