Skip to content

Commit 27c2736

Browse files
committed
add github action for releases
1 parent dbd8e1b commit 27c2736

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: [ '*' ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: "22"
19+
registry-url: "https://registry.npmjs.com/"
20+
- run: npm ci
21+
- name: Publish to npmjs.com
22+
if: startsWith(github.ref, 'refs/tags/')
23+
run: npm publish --provenance --access public
24+
env:
25+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26+
- name: Pack
27+
uses: softprops/action-gh-release@v2
28+
if: startsWith(github.ref, 'refs/tags/')
29+
with:
30+
files: "*.tar.gz"
31+
- name: Create package
32+
if: startsWith(github.ref, 'refs/tags/')
33+
run: |
34+
rm -rf *.tgz
35+
npm pack
36+
- name: Check file existence
37+
id: check_files
38+
uses: andstor/file-existence-action@v3
39+
with:
40+
files: "*.tgz"
41+
- name: On Build Failure
42+
if: steps.check_files.outputs.files_exists == 'false'
43+
run: |
44+
echo "Packaging FAILED" && exit 1

0 commit comments

Comments
 (0)