Skip to content

Commit f41e298

Browse files
authored
Add build workflow and release automation. (#24)
Introduce a new build job in the CI workflow to handle building and uploading artifacts. Additionally, create a release workflow triggered on new releases to package and upload release assets for distribution.
1 parent 34b75d1 commit f41e298

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

.github/workflows/CI.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,30 @@ jobs:
4949
run: npm ci
5050

5151
- name: Run linting
52-
run: npm run lint
52+
run: npm run lint
53+
54+
build:
55+
name: build
56+
needs: [test]
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Setup Node.js
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: '20.x'
65+
cache: 'npm'
66+
67+
- name: Install dependencies
68+
run: npm ci
69+
70+
- name: Build frontend
71+
run: npm run build
72+
73+
- name: Upload build artifact
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: dist
77+
path: dist/
78+
retention-days: 1

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-upload:
12+
name: Build and Upload Release Assets
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20.x'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Build frontend
27+
run: npm run build
28+
29+
- name: Zip dist directory
30+
run: zip -r dist.zip dist
31+
32+
- name: Upload dist as release asset
33+
uses: actions/upload-release-asset@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
upload_url: ${{ github.event.release.upload_url }}
38+
asset_path: ./dist.zip
39+
asset_name: dist.zip
40+
asset_content_type: application/zip

0 commit comments

Comments
 (0)