Skip to content

Commit 74ffe0f

Browse files
author
timiagama
committed
npm-publish workflow now only triggers publish onr elease
1 parent 8727e05 commit 74ffe0f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/npm-publish.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# .github/workflows/npm-publish.yml
2-
name: Publish to NPM
2+
name: Build and Publish
33

44
on:
55
push:
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v3
2121
- uses: actions/setup-node@v3
2222
with:
23-
node-version: '16.x'
23+
node-version: '18.x'
2424
registry-url: 'https://registry.npmjs.org'
2525

2626
- name: Install dependencies
@@ -34,6 +34,23 @@ jobs:
3434

3535
- name: Build
3636
run: npm run build
37+
38+
publish:
39+
needs: build
40+
if: github.event_name == 'release'
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
- uses: actions/setup-node@v3
45+
with:
46+
node-version: '18.x'
47+
registry-url: 'https://registry.npmjs.org'
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Build
53+
run: npm run build
3754

3855
- name: Publish to NPM
3956
run: npm publish

0 commit comments

Comments
 (0)