Skip to content

Commit da35fa2

Browse files
committed
Enhance GitHub Actions workflow to build and upload standalone applications for both x86_64 and arm64 architectures
1 parent 3990560 commit da35fa2

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

.github/workflows/Standalone.yaml

+31-11
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,23 @@ jobs:
2929
pip install -r requirements.txt
3030
pip install pyinstaller
3131
32-
# 4. 使用 PyInstaller 打包
32+
# 4. 使用 PyInstaller 打包两个架构
3333
- name: Build standalone application
3434
run: |
35-
# 生成单文件可执行程序
36-
pyinstaller --onefile everything.py
37-
# 将 dist 目录打包成 zip 以便上传
38-
zip -r everything-dist.zip dist
35+
# 创建x86_64版本
36+
pyinstaller --target-architecture x86_64 --onefile --windowed --noconsole everything.py
37+
mkdir -p dist_x86_64
38+
mv dist/everything dist_x86_64/
39+
zip -r everything-x86_64.zip dist_x86_64
40+
41+
# 清理构建文件
42+
rm -rf build dist
43+
44+
# 创建arm64版本
45+
pyinstaller --target-architecture arm64 --onefile --windowed --noconsole everything.py
46+
mkdir -p dist_arm64
47+
mv dist/everything dist_arm64/
48+
zip -r everything-arm64.zip dist_arm64
3949
4050
# 5. 创建 GitHub Release
4151
- name: Create GitHub release
@@ -49,14 +59,24 @@ jobs:
4959
draft: false
5060
prerelease: false
5161

52-
# 6. 上传打包好的 zip 文件到 Release
53-
- name: Upload release asset
54-
id: upload_release_asset
62+
# 6. 上传 x86_64 版本
63+
- name: Upload x86_64 release asset
5564
uses: actions/upload-release-asset@v1
5665
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # <-- Important for authentication!
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
upload_url: ${{ steps.create_release.outputs.upload_url }}
69+
asset_path: everything-x86_64.zip
70+
asset_name: everything-x86_64.zip
71+
asset_content_type: application/zip
72+
73+
# 7. 上传 arm64 版本
74+
- name: Upload arm64 release asset
75+
uses: actions/upload-release-asset@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5878
with:
5979
upload_url: ${{ steps.create_release.outputs.upload_url }}
60-
asset_path: everything-dist.zip
61-
asset_name: everything-dist.zip
80+
asset_path: everything-arm64.zip
81+
asset_name: everything-arm64.zip
6282
asset_content_type: application/zip

0 commit comments

Comments
 (0)