-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpyinstaller_package_and_release.yml
More file actions
87 lines (74 loc) · 2.45 KB
/
pyinstaller_package_and_release.yml
File metadata and controls
87 lines (74 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Pyinstaller Package and Release
on:
workflow_dispatch:
# push:
# branches:
# - main
# paths:
# - 'package/config.yml'
jobs:
package-and-release:
runs-on: windows-latest
# 添加必要的权限
permissions:
contents: write # 允许创建发布和上传资源
steps:
- name: Set Timezone to China Standard Time
run: tzutil /s "China Standard Time"
shell: pwsh
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Generate version tag
id: version
run: |
# 使用 UTC 时间确保一致性
$date = (Get-Date).ToUniversalTime().ToString("yy.MM.dd")
$tag = "v$date"
$release = "Release $date"
echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "release_name=$release" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: UPX Setup
run: |
mkdir upx
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller pyyaml
- name: Fix Python encoding (Windows)
run: |
# 设置Python使用UTF-8编码
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# 设置控制台编码为UTF-8
chcp.com 65001
- name: Run packaging script
run: |
cd package
python pyinstaller_build.py pyinstaller_config.yml
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.release_name }}
generate_release_notes: true
draft: false
prerelease: false
overwrite_files: true
files: |
dist/*.exe
# - name: Upload Release Assets
# uses: xresloader/upload-to-github-release@main
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# file: "./dist/*.exe"
# release_id: ${{ steps.create_release.outputs.id }}
# verbose: false
# overwrite: true