Skip to content

Commit fc30ec4

Browse files
authored
chore: add publish workflow (#67)
1 parent a3bb442 commit fc30ec4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 22
15+
- run: npm ci --ignore-scripts
16+
- run: npm run lint
17+
- run: npm test
18+
19+
publish-npm:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
permissions:
23+
id-token: write
24+
steps:
25+
- uses: actions/checkout@v5
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 22.x
29+
registry-url: 'https://registry.npmjs.org'
30+
cache: 'npm'
31+
- run: npm i -g npm@latest
32+
- run: npm ci --ignore-scripts
33+
- run: npm version ${TAG_NAME} --git-tag-version=false
34+
env:
35+
TAG_NAME: ${{ github.ref_name }}
36+
- run: npm publish --provenance --access public --tag next
37+
if: "github.event.release.prerelease"
38+
- run: npm publish --provenance --access public
39+
if: "!github.event.release.prerelease"

0 commit comments

Comments
 (0)