Skip to content

Commit c241f5f

Browse files
committed
Automatically publish npm pack to GH Releases
1 parent f0ac5af commit c241f5f

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ on:
22
push:
33
branches:
44
- main
5-
65
pull_request:
6+
release:
7+
types: [created]
78

89
jobs:
910
build:
@@ -18,9 +19,25 @@ jobs:
1819

1920
- run: npm ci
2021
- run: npm run build
21-
22-
- name: Verify that `npm run build` did not change outputs
23-
run: git diff --exit-code
24-
2522
- run: npm test
2623
- run: npm run lint
24+
25+
package:
26+
runs-on: ubuntu-latest
27+
if: github.event_name == 'release'
28+
needs: build
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 18
34+
cache: npm
35+
36+
- run: npm ci
37+
- run: npm pack
38+
39+
- name: Upload package to release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
gh release upload ${{ github.event.release.tag_name }} ./*.tgz

0 commit comments

Comments
 (0)