Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit d5c20b6

Browse files
committed
ci: add build
1 parent 59e868a commit d5c20b6

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

.github/workflows/build.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build Backend with Frontend
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# 1. Checkout 后端仓库
15+
- name: Checkout code
16+
uses: actions/checkout@v5
17+
18+
# 2. 下载前端 zip
19+
- name: Download frontend build
20+
run: |
21+
curl -L -o canteen-frontend-build.zip https://nightly.link/itsHenry35/canteen-management-system-frontend/workflows/build/master/canteen-frontend-build.zip
22+
23+
# 3. 安装 unzip
24+
- name: Install unzip
25+
run: sudo apt-get update && sudo apt-get install -y unzip
26+
27+
# 4. 解压到 static/
28+
- name: Unzip frontend
29+
run: |
30+
mkdir -p static
31+
unzip -o canteen-frontend-build.zip -d static
32+
33+
# 5. Setup Go
34+
- name: Setup Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: 1.24
38+
39+
# 6. 编译Linux
40+
- name: Build Linux binary
41+
id: build-linux
42+
uses: go-cross/cgo-actions@v1
43+
with:
44+
dir: '.'
45+
targets: linux/amd64
46+
47+
# 7. 上传Linux构建产物
48+
- name: Upload Linux artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: canteen-management-system-linux
52+
path: ${{ steps.build-linux.outputs.files }}
53+
54+
# 8. 编译Windows
55+
- name: Build Windows binary
56+
id: build-windows
57+
uses: go-cross/cgo-actions@v1
58+
with:
59+
dir: '.'
60+
targets: windows/amd64
61+
62+
# 9. 上传Windows构建产物
63+
- name: Upload Windows artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: canteen-management-system-windows
67+
path: ${{ steps.build-windows.outputs.files }}

.github/workflows/jekyll-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2727
- name: Setup Pages
2828
uses: actions/configure-pages@v5
2929
- name: Build with Jekyll

0 commit comments

Comments
 (0)