-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (96 loc) · 3.49 KB
/
pyinstaller-windows.yml
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
88
89
90
91
92
93
94
95
96
97
98
---
name: Pyinstaller Build for Windows 64-bit on windows-latest
on:
release:
types: ["published"]
push:
branches: ["develop", "trunk"]
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Cache downloaded ffmpeg.exe
uses: actions/cache@v4
id: cache-ffmpeg-exe
with:
path: ${{ github.workspace }}\ffmpeg.exe
key: ffmpeg-n7.0-from-media-autobuild-suite
- name: Download ffmpeg binary if not found
if: steps.cache-ffmpeg-exe.outputs.cache-hit != 'true'
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/ebb-earl-co/media-autobuild_suite/releases/download/n7.0/ffmpeg.exe" -OutFile "ffmpeg.exe"
- name: Cache UPX 4.2.3 zip downloaded from GitHub
uses: actions/cache@v4
id: cache-upx-423
with:
path: ~\AppData\Local\upx-4.2.3-win64.zip
key: upx-423-from-github
- name: Download UPX binary if not found
if: steps.cache-upx-423.outputs.cache-hit != 'true'
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/upx/upx/releases/download/v4.2.3/upx-4.2.3-win64.zip" -OutFile "~\AppData\Local\upx-4.2.3-win64.zip"
- name: Install UPX tool
shell: pwsh
run: |
Expand-Archive "~\AppData\Local\upx-4.2.3-win64.zip" -DestinationPath "~\AppData\Local\upx-4.2.3-win64"
- name: Set up Python
uses: actions/setup-python@v5
with:
architecture: "x64"
cache: "pip"
python-version: "3.12.7"
- name: Install Python dependencies
shell: pwsh
run: |
python.exe -m venv .\venv
& .\venv\Scripts\activate
pip install --upgrade pip setuptools wheel
pip install pyinstaller==6.7.0 pypiwin32==223
pip install -r requirements.txt
- name: Create Executable with Pyinstaller
run: |
& .\venv\Scripts\activate
pyinstaller `
--name tidal-wave_windows.exe `
--paths tidal_wave `
--add-binary "ffmpeg.exe:." `
--exclude-module pyinstaller `
--exclude-module ruff `
--clean `
--upx-dir "~\AppData\Local\upx-4.2.3-win64" `
--onefile `
.\pyinstaller.py
- name: Test just-compiled binary
shell: pwsh
run: |
& .\dist\tidal-wave_windows.exe --help
- name: Create SHA256 checksum file of just-compiled binary
shell: pwsh
run: |
python.exe -c "from hashlib import sha256;from pathlib import Path;Path('tidal-wave_windows.exe.sha256').write_text(f'''{sha256(Path('./dist/tidal-wave_windows.exe').read_bytes()).hexdigest()}\ttidal-wave_windows.exe''')"
cat tidal-wave_windows.exe.sha256
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
compression-level: 9
name: tidal-wave_windows
overwrite: true
path: |
.\dist\tidal-wave_windows.exe
.\tidal-wave_windows.exe.sha256
retention-days: 7
- name: Add artifact to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
.\dist\tidal-wave_windows.exe
.\tidal-wave_windows.exe.sha256
token: ${{ github.token }}