Skip to content

Commit d889993

Browse files
committed
ci: add fork build workflow (linux/amd64 binary + release on tag)
1 parent 859f4be commit d889993

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build sub2api (opencode-pool)
2+
3+
# Fork 专用构建:产出单文件 linux/amd64 二进制(含前端 embed)。
4+
# 手动触发:构建 + 上传 artifact;
5+
# tag 推送(v*):构建 + 上传 artifact + 发布 GitHub Release(服务器部署脚本从此拉取)。
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
tags:
13+
- 'v*'
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v6
27+
with:
28+
version: 9
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v6
32+
with:
33+
node-version: '20'
34+
cache: 'pnpm'
35+
cache-dependency-path: frontend/pnpm-lock.yaml
36+
37+
- name: Setup Go
38+
uses: actions/setup-go@v6
39+
with:
40+
go-version: '1.26.x'
41+
cache-dependency-path: backend/go.sum
42+
43+
- name: Build frontend
44+
run: |
45+
pnpm install --frozen-lockfile
46+
pnpm run build
47+
working-directory: frontend
48+
49+
- name: Build backend (linux/amd64)
50+
run: make -C backend build
51+
env:
52+
CGO_ENABLED: '0'
53+
GOOS: linux
54+
GOARCH: amd64
55+
56+
- name: Upload artifact
57+
uses: actions/upload-artifact@v7
58+
with:
59+
name: sub2api-linux-amd64
60+
path: backend/bin/server
61+
retention-days: 14
62+
63+
- name: Publish release (tags only)
64+
if: startsWith(github.ref, 'refs/tags/')
65+
uses: softprops/action-gh-release@v2
66+
with:
67+
files: backend/bin/server
68+
generate_release_notes: true

0 commit comments

Comments
 (0)