Skip to content

Commit 296fc29

Browse files
committed
ci: 添加构建与发布 workflow
1 parent 8fc6482 commit 296fc29

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build & Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-frontend:
10+
name: Build Frontend
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v4
25+
26+
- name: Install and Build
27+
working-directory: ChuChartManager/Front
28+
run: |
29+
pnpm install
30+
pnpm build
31+
32+
- name: Upload wwwroot
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: wwwroot
36+
path: ChuChartManager/wwwroot
37+
38+
build-backend:
39+
name: Build Backend
40+
runs-on: windows-latest
41+
needs: build-frontend
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
with:
46+
submodules: recursive
47+
48+
- name: Setup .NET
49+
uses: actions/setup-dotnet@v4
50+
with:
51+
dotnet-version: '10.0.x'
52+
dotnet-quality: 'preview'
53+
54+
- name: Download wwwroot
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: wwwroot
58+
path: ChuChartManager/wwwroot
59+
60+
- name: Publish
61+
run: |
62+
dotnet publish ChuChartManager/ChuChartManager.csproj -c Release -r win-x64 --self-contained -o publish /p:PublishSingleFile=false
63+
64+
- name: Package
65+
shell: pwsh
66+
run: |
67+
Compress-Archive -Path publish/* -DestinationPath ChuChartManager-win-x64.zip
68+
69+
- name: Upload artifact
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: ChuChartManager-win-x64
73+
path: ChuChartManager-win-x64.zip
74+
75+
release:
76+
name: Create Release
77+
runs-on: ubuntu-latest
78+
needs: build-backend
79+
if: startsWith(github.ref, 'refs/tags/v')
80+
permissions:
81+
contents: write
82+
steps:
83+
- name: Download artifact
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: ChuChartManager-win-x64
87+
88+
- name: Create Release
89+
uses: softprops/action-gh-release@v2
90+
with:
91+
files: ChuChartManager-win-x64.zip
92+
generate_release_notes: true
93+
prerelease: true

0 commit comments

Comments
 (0)