Skip to content

Commit 489dfca

Browse files
authored
chore: add publish workflow (#62)
Adds a publish workflow so we can start releasing via GitHub.
1 parent f3d0c31 commit 489dfca

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish Release (npm)
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- name: Setup Node
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
- name: Install Dependencies
18+
run: npm ci
19+
- name: Lint
20+
run: npm run lint
21+
- name: Test
22+
run: npm test
23+
24+
publish-npm:
25+
needs: build
26+
runs-on: ubuntu-latest
27+
permissions:
28+
id-token: write
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 22.x
34+
registry-url: 'https://registry.npmjs.org'
35+
cache: 'npm'
36+
- run: npm ci
37+
- run: npm version ${TAG_NAME} --git-tag-version=false
38+
env:
39+
TAG_NAME: ${{ github.ref_name }}
40+
- run: npm publish --provenance --access public --tag next
41+
if: "github.event.release.prerelease"
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
44+
- run: npm publish --provenance --access public
45+
if: "!github.event.release.prerelease"
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

0 commit comments

Comments
 (0)