Skip to content

Commit 35e20e7

Browse files
committed
0.1.1
1 parent 363b4d6 commit 35e20e7

1 file changed

Lines changed: 149 additions & 0 deletions

File tree

.github/workflows/go-build.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Go Build
2+
3+
# 触发条件
4+
on:
5+
push:
6+
branches: [ main, master ]
7+
paths:
8+
- '**.go' # 当Go文件变更时触发
9+
- '.github/workflows/go-build.yml' # 当工作流文件本身变更时触发
10+
workflow_dispatch: # 支持手动触发
11+
12+
jobs:
13+
build-api-pool:
14+
name: Build api-pool
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
os: [windows, linux]
19+
arch: [amd64]
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v4
26+
with:
27+
go-version: '1.21'
28+
check-latest: true
29+
cache: true
30+
31+
- name: Set version
32+
id: set-version
33+
run: |
34+
echo "version=$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
35+
36+
- name: Build for ${{ matrix.os }}-${{ matrix.arch }}
37+
env:
38+
GOOS: ${{ matrix.os }}
39+
GOARCH: ${{ matrix.arch }}
40+
VERSION: ${{ steps.set-version.outputs.version }}
41+
run: |
42+
# 设置文件扩展名(Windows为.exe,其他无扩展名)
43+
if [ "${{ matrix.os }}" == "windows" ]; then
44+
EXT=".exe"
45+
else
46+
EXT=""
47+
fi
48+
49+
BINARY_NAME="api-pool-${{ matrix.os }}-${{ matrix.arch }}${EXT}"
50+
go build -ldflags "-X main.AppVersion=$VERSION" -o "$BINARY_NAME" ./api-pool.go
51+
52+
- name: Upload Artifact
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: api-pool-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.set-version.outputs.version }}
56+
path: api-pool-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
57+
retention-days: 7
58+
59+
build-wo2api:
60+
name: Build wo2api
61+
runs-on: ubuntu-latest
62+
strategy:
63+
matrix:
64+
os: [windows, linux]
65+
arch: [amd64]
66+
steps:
67+
- name: Check out code
68+
uses: actions/checkout@v4
69+
70+
- name: Set up Go
71+
uses: actions/setup-go@v4
72+
with:
73+
go-version: '1.21'
74+
check-latest: true
75+
cache: true
76+
77+
- name: Set version
78+
id: set-version
79+
run: |
80+
echo "version=$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
81+
82+
- name: Build for ${{ matrix.os }}-${{ matrix.arch }}
83+
env:
84+
GOOS: ${{ matrix.os }}
85+
GOARCH: ${{ matrix.arch }}
86+
VERSION: ${{ steps.set-version.outputs.version }}
87+
run: |
88+
# 设置文件扩展名(Windows为.exe,其他无扩展名)
89+
if [ "${{ matrix.os }}" == "windows" ]; then
90+
EXT=".exe"
91+
else
92+
EXT=""
93+
fi
94+
95+
BINARY_NAME="wo2api-${{ matrix.os }}-${{ matrix.arch }}${EXT}"
96+
go build -ldflags "-X main.AppVersion=$VERSION" -o "$BINARY_NAME" ./wo2api.go
97+
98+
- name: Upload Artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: wo2api-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.set-version.outputs.version }}
102+
path: wo2api-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
103+
retention-days: 7
104+
105+
build-hunyuan2api:
106+
name: Build hunyuan2api
107+
runs-on: ubuntu-latest
108+
strategy:
109+
matrix:
110+
os: [windows, linux]
111+
arch: [amd64]
112+
steps:
113+
- name: Check out code
114+
uses: actions/checkout@v4
115+
116+
- name: Set up Go
117+
uses: actions/setup-go@v4
118+
with:
119+
go-version: '1.21'
120+
check-latest: true
121+
cache: true
122+
123+
- name: Set version
124+
id: set-version
125+
run: |
126+
echo "version=$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
127+
128+
- name: Build for ${{ matrix.os }}-${{ matrix.arch }}
129+
env:
130+
GOOS: ${{ matrix.os }}
131+
GOARCH: ${{ matrix.arch }}
132+
VERSION: ${{ steps.set-version.outputs.version }}
133+
run: |
134+
# 设置文件扩展名(Windows为.exe,其他无扩展名)
135+
if [ "${{ matrix.os }}" == "windows" ]; then
136+
EXT=".exe"
137+
else
138+
EXT=""
139+
fi
140+
141+
BINARY_NAME="hunyuan2api-${{ matrix.os }}-${{ matrix.arch }}${EXT}"
142+
go build -ldflags "-X main.AppVersion=$VERSION" -o "$BINARY_NAME" ./hunyuan2api.go
143+
144+
- name: Upload Artifact
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: hunyuan2api-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.set-version.outputs.version }}
148+
path: hunyuan2api-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
149+
retention-days: 7

0 commit comments

Comments
 (0)