-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (65 loc) · 2.36 KB
/
Copy pathbuild.yml
File metadata and controls
76 lines (65 loc) · 2.36 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
name: Build Windows executable
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write # required for softprops/action-gh-release to create release + upload assets
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pyinstaller
- name: Build single-file executable
run: |
pyinstaller --onefile --windowed `
--name guling-trader `
--paths src `
--icon src/trader/assets/icon.ico `
--collect-submodules trader `
--collect-data certifi `
run_trader.py
shell: pwsh
# Note: Tesseract bundle deferred (UB-Mannheim 403's GitHub Actions IP).
# 用户需要在 bottle 里手动装 Tesseract for Windows(一次性),或等 v0.2.1
# 改成 chocolatey / 官方 GitHub release 源。
- name: Verify executable size
shell: pwsh
run: |
$exePath = "dist\guling-trader.exe"
$sizeBytes = (Get-Item $exePath).Length
$sizeMB = [math]::Round($sizeBytes / 1MB, 2)
Write-Host "✓ 构建完成:$sizeMB MB"
if ($sizeMB -gt 100) {
Write-Host "⚠ 警告:executable 大小超过 100MB ($sizeMB MB)"
}
- name: Compute SHA-256 checksum
run: |
$hash = (Get-FileHash -Algorithm SHA256 dist\guling-trader.exe).Hash
"$hash guling-trader.exe" | Out-File -Encoding ASCII dist\guling-trader.exe.sha256
shell: pwsh
- name: Upload artifacts (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: guling-trader-win
path: |
dist/guling-trader.exe
dist/guling-trader.exe.sha256
- name: Publish GitHub Release (tag push)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
dist/guling-trader.exe
dist/guling-trader.exe.sha256
generate_release_notes: true