1- name : 统一构建流程
1+ name : 构建流程
22
33# 环境变量
44env :
99
1010on :
1111 push :
12- branches :
13- - master
1412 pull_request :
15- branches :
16- - master
1713 workflow_dispatch :
18- inputs :
19- build_target :
20- description : ' 构建目标 (all/windows/linux)'
21- required : false
22- default : ' all'
23- type : choice
24- options :
25- - all
26- - windows
27- - linux
28- release :
29- description : ' 是否发布版本'
30- required : false
31- default : ' false'
32- type : choice
33- options :
34- - true
35- - false
36- package :
37- description : ' 是否打包应用'
38- required : false
39- default : ' true'
40- type : choice
41- options :
42- - true
43- - false
4414
4515concurrency :
4616 group : build-${{ github.ref }}
@@ -138,7 +108,7 @@ jobs:
138108 run : mkdir zip
139109
140110 - name : 更新 version_info.txt
141- if : startsWith(github.ref_name, 'v') && contains(github.ref_name, '.') && !contains(github.ref_name, '-') && (github.event_name != 'workflow_dispatch' || inputs.package == 'true')
111+ if : startsWith(github.ref_name, 'v')
142112 run : |
143113 python update_version.py
144114 env :
@@ -172,9 +142,7 @@ jobs:
172142
173143 # Windows 打包操作
174144 - name : Windows 打包操作
175- if : |
176- matrix.platform == 'windows' &&
177- (github.event_name != 'workflow_dispatch' || inputs.package == 'true')
145+ if : matrix.platform == 'windows'
178146 run : |
179147 echo "开始 Windows 打包操作..."
180148
@@ -213,9 +181,7 @@ jobs:
213181
214182 # Linux 打包操作
215183 - name : Linux 打包操作
216- if : |
217- matrix.platform == 'linux' &&
218- (github.event_name != 'workflow_dispatch' || inputs.package == 'true')
184+ if : matrix.platform == 'linux'
219185 run : |
220186 echo "开始 Linux 打包操作..."
221187
@@ -254,9 +220,7 @@ jobs:
254220 echo "目录模式打包完成: zip/SecRandom-${{ matrix.platform }}-${{ github.ref_name }}-${{ matrix.arch }}-${{ matrix.pack_mode }}.zip"
255221
256222 - name : 上传应用程序
257- if : |
258- github.event_name != 'pull_request' &&
259- (github.event_name != 'workflow_dispatch' || inputs.package == 'true')
223+ if : github.event_name != 'pull_request'
260224 uses : actions/upload-artifact@v4.4.2
261225 with :
262226 name : ${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.pack_mode }}
@@ -265,26 +229,11 @@ jobs:
265229
266230 release :
267231 needs : [builder_matrix]
268- if : |
269- (startsWith(github.ref, 'refs/tags/v') &&
270- contains(github.ref_name, '.') &&
271- (github.event_name != 'workflow_dispatch' || inputs.release == 'true')) ||
272- (github.event_name == 'workflow_dispatch' && inputs.release == 'true')
232+ if : ${{startsWith(github.ref, 'refs/tags/')}}
273233 runs-on : ubuntu-latest
274234 permissions :
275235 contents : write
276236 steps :
277- - name : 安全检查
278- run : |
279- echo "执行安全检查..."
280- # 检查敏感文件
281- if [ -f ".env" ]; then
282- echo "警告: 发现 .env 文件,请检查是否包含敏感信息"
283- fi
284- # 检查文件权限
285- find . -type f -name "*.py" -perm /002 -exec echo "警告: {} 文件权限过于宽松" \; 2>/dev/null || true
286- echo "安全检查完成"
287-
288237 - name : 检出仓库
289238 uses : actions/checkout@v4.2.2
290239 with :
0 commit comments