Skip to content

Commit 254aa60

Browse files
authored
Add job for publishing to npm (#2)
1 parent bb2a1c5 commit 254aa60

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ on:
44
pull_request:
55
push:
66
branches: [ "main" ]
7-
tags: [ "*" ]
7+
release:
8+
types: [created]
89

910
jobs:
1011
build:
11-
1212
runs-on: ubuntu-latest
13-
1413
strategy:
1514
matrix:
1615
node-version: [18.x, 20.x, 22.x]
17-
1816
steps:
1917
- uses: actions/checkout@v4
2018
- name: Use Node.js ${{ matrix.node-version }}
@@ -24,3 +22,18 @@ jobs:
2422
cache: 'npm'
2523
- run: npm ci
2624
- run: npm run build --if-present
25+
26+
publish-npm:
27+
needs: build
28+
runs-on: ubuntu-latest
29+
if: github.event_name == 'release'
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
registry-url: https://registry.npmjs.org/
36+
- run: npm ci
37+
- run: npm publish
38+
env:
39+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)