11name : 构建
22
3- on :
3+ on :
44 push :
55 pull_request :
66 workflow_dispatch :
1313 builder_matrix :
1414 # 仅在push或pull_request事件包含'进行打包'时执行,workflow_dispatch无条件执行
1515 if : |
16- github.event_name == 'workflow_dispatch' ||
16+ github.event_name == 'workflow_dispatch' ||
1717 contains(github.event.head_commit.message, '进行打包') ||
1818 (github.event_name == 'pull_request' && contains(github.event.pull_request.title, '进行打包'))
1919 strategy :
@@ -58,21 +58,21 @@ jobs:
5858 echo "创建虚拟环境..."
5959 uv venv
6060 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
61-
61+
6262 # 激活虚拟环境
6363 echo "激活虚拟环境..."
6464 .venv/Scripts/activate
65-
65+
6666 # 安装依赖
6767 echo "安装项目依赖..."
6868 uv pip install -r requirements-windows.txt
6969 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
70-
70+
7171 # 安装 pyinstaller
7272 echo "安装 PyInstaller..."
7373 uv pip install pyinstaller
7474 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
75-
75+
7676 # 清理之前的构建文件
7777 echo "清理之前的构建文件..."
7878 Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue
@@ -91,33 +91,33 @@ jobs:
9191 --add-data ./app/resources:app/resources `
9292 --add-data LICENSE:. `
9393 --version-file=version_info.txt
94- if ($LASTEXITCODE -ne 0) {
94+ if ($LASTEXITCODE -ne 0) {
9595 echo "目录模式打包失败"
96- exit $LASTEXITCODE
96+ exit $LASTEXITCODE
9797 }
9898 echo "目录模式打包完成"
9999 }
100100
101101 - name : 打包操作
102- if : ${{ matrix.os == 'windows-2022'}}
102+ if : ${{ matrix.os == 'windows-2022'}}
103103 run : |
104104 echo "开始打包操作..."
105-
105+
106106 # 创建zip_dist/SecRandom目录
107107 mkdir -p zip_dist/SecRandom
108-
108+
109109 # 复制dist/SecRandom目录下的所有文件到zip_dist/SecRandom目录下
110110 Copy-Item -Recurse -Force dist/SecRandom/* zip_dist/SecRandom/
111-
111+
112112 # 创建app目录
113113 mkdir -p zip_dist/SecRandom/app
114-
114+
115115 # 复制app/resources文件夹到zip_dist/SecRandom目录下
116116 Copy-Item -Recurse -Force app/resources zip_dist/SecRandom/app
117-
117+
118118 # 复制 LICENSE 文件到zip_dist/SecRandom目录下
119119 Copy-Item LICENSE zip_dist/SecRandom/
120-
120+
121121 # 使用 zip 压缩文件
122122 mkdir zip -Force
123123 $outputZip = "zip/SecRandom-Windows-${{ github.ref_name }}-${{ matrix.arch }}-dir.zip"
@@ -163,7 +163,7 @@ jobs:
163163 path : artifacts
164164 run-id : ${{ github.run_id }}
165165
166- - name : 准备 artifacts
166+ - name : 准备 artifacts
167167 run : |
168168 echo "整理构建产物..."
169169 # Windows 构建产物
@@ -185,7 +185,7 @@ jobs:
185185 done
186186 echo "SHA256校验值计算完成:"
187187 cat SHA256SUMS.txt
188-
188+
189189 - name : 验证 SHA256SUMS.txt 文件
190190 run : |
191191 echo "验证SHA256SUMS.txt文件..."
@@ -230,7 +230,7 @@ jobs:
230230 done < SHA256SUMS.txt
231231 rm SHA256SUMS.txt
232232 cd ..
233-
233+
234234 - name : 确定发布类型
235235 id : release-type
236236 run : |
@@ -252,4 +252,4 @@ jobs:
252252 name : SecRandom 新版本 - ${{ github.ref_name }}
253253 fail_on_unmatched_files : true
254254 env :
255- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
255+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments