Skip to content

Commit f23c21c

Browse files
authored
Add GitHub Actions workflow for build and release
1 parent e55b0d8 commit f23c21c

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Release
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Archive build output
28+
run: tar -czf dist.tar.gz .
29+
30+
- name: Upload build artifact (for workflow logs)
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: dist
34+
path: dist
35+
36+
- name: Create GitHub Release and upload asset
37+
uses: ncipollo/release-action@v1
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
tag: release-${{ github.run_id }}
41+
name: Release ${{ github.run_number }}
42+
body: |
43+
Automated release for commit ${{ github.sha }} on branch ${{ github.ref_name }}.
44+
- Trigger: push to main
45+
- Run number: ${{ github.run_number }}
46+
artifacts: dist.tar.gz
47+
allowUpdates: false
48+
draft: false
49+
prerelease: false
50+
makeLatest: true

0 commit comments

Comments
 (0)