Skip to content

Commit 794cb43

Browse files
committed
新增自动打包和发布工作流,支持多操作系统构建,优化依赖安装和文件上传步骤
1 parent 4c2ebad commit 794cb43

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Package and Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- dev
8+
paths:
9+
- 'package/config.yml'
10+
11+
jobs:
12+
package:
13+
strategy:
14+
matrix:
15+
os: [windows-latest, windows-11-arm]
16+
runs-on: os.${{ matrix.os }}
17+
18+
# 添加必要的权限
19+
permissions:
20+
contents: write # 允许创建发布和上传资源
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # 获取所有历史记录以便生成标签
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.12'
32+
33+
- name: UPX Setup(Windows amd64)
34+
if: ${{ matrix.os == 'windows-latest' }}
35+
run: |
36+
mkdir upx
37+
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install pyinstaller pyyaml
43+
44+
- name: Fix Python encoding (Windows)
45+
run: |
46+
# 设置Python使用UTF-8编码
47+
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
48+
# 设置控制台编码为UTF-8
49+
chcp.com 65001
50+
51+
- name: Run packaging script
52+
run: |
53+
cd package
54+
python build.py config.yml
55+
56+
- name: Upload files with wildcards
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: Artifact
60+
path: |
61+
./dist/*.exe
62+
./dist/*.zip
63+
retention-days: 90
64+
if-no-files-found: warn
65+
overwrite: true

0 commit comments

Comments
 (0)