Skip to content

Commit c1bd1c4

Browse files
Merge pull request #73 from nicolasbisurgi/feature/build-workflow-and-exe-fixes
Fix PyInstaller build and publish releases
2 parents af30345 + 6749e20 commit c1bd1c4

3 files changed

Lines changed: 50 additions & 65 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- master
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
build-windows:
1013
name: Build on Windows
@@ -13,10 +16,10 @@ jobs:
1316
contents: write
1417
steps:
1518
- name: Checkout code
16-
uses: actions/checkout@v4
19+
uses: actions/checkout@v6
1720

1821
- name: Set up Python
19-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v6
2023
with:
2124
python-version: '3.x'
2225

@@ -26,72 +29,17 @@ jobs:
2629
pip install pyinstaller
2730
pip install -r requirements.txt
2831
29-
- name: Generate PyInstaller spec file
30-
run: |
31-
$specContent = @"
32-
# -*- mode: python ; coding: utf-8 -*-
33-
34-
a = Analysis(
35-
['optimuspy.py'],
36-
pathex=[],
37-
binaries=[],
38-
datas=[('execution_mode.py', '.'), ('executors.py', '.'), ('results.py', '.')],
39-
hiddenimports=['seaborn', 'execution_mode', 'executors', 'results','win32timezone'],
40-
hookspath=[],
41-
hooksconfig={},
42-
runtime_hooks=[],
43-
excludes=[],
44-
noarchive=False,
45-
optimize=0,
46-
)
47-
pyz = PYZ(a.pure)
48-
49-
exe = EXE(
50-
pyz,
51-
a.scripts,
52-
a.binaries,
53-
a.datas,
54-
[],
55-
name='optimuspy',
56-
debug=False,
57-
bootloader_ignore_signals=False,
58-
strip=False,
59-
upx=True,
60-
upx_exclude=[],
61-
runtime_tmpdir=None,
62-
console=True,
63-
disable_windowed_traceback=False,
64-
argv_emulation=False,
65-
target_arch=None,
66-
codesign_identity=None,
67-
entitlements_file=None,
68-
)
69-
"@
70-
Set-Content -Path "optimuspy.spec" -Value $specContent
71-
7232
- name: Build executable
7333
run: pyinstaller optimuspy.spec
7434

75-
- name: Upload executable artifact
76-
uses: actions/upload-artifact@v4
77-
with:
78-
name: optimuspy-windows
79-
path: dist/optimuspy.exe
80-
retention-days: 180
35+
- name: Get short SHA
36+
id: sha
37+
run: echo "short=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT
8138

82-
- name: Attach to latest release
39+
- name: Create Release
8340
uses: softprops/action-gh-release@v2
8441
with:
42+
tag_name: build-${{ steps.sha.outputs.short }}
43+
name: Build ${{ steps.sha.outputs.short }}
44+
body: "Automated build from commit ${{ github.sha }}"
8545
files: dist/optimuspy.exe
86-
tag_name: latest
87-
name: Latest Build
88-
body: |
89-
Latest Windows executable build from master branch.
90-
91-
**Download:** optimuspy.exe
92-
93-
This executable is automatically built and updated on every merge to master.
94-
draft: false
95-
prerelease: false
96-
env:
97-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ dist/
44
build/
55
__pycache__/
66
*.pyc
7-
*.spec
87
results/
98
*.log

optimuspy.spec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
a = Analysis(
5+
['optimuspy.py'],
6+
pathex=[],
7+
binaries=[],
8+
datas=[('execution_mode.py', '.'), ('executors.py', '.'), ('results.py', '.')],
9+
hiddenimports=['seaborn', 'execution_mode', 'executors', 'results','win32timezone'],
10+
hookspath=[],
11+
hooksconfig={},
12+
runtime_hooks=[],
13+
excludes=[],
14+
noarchive=False,
15+
optimize=0,
16+
)
17+
pyz = PYZ(a.pure)
18+
19+
exe = EXE(
20+
pyz,
21+
a.scripts,
22+
a.binaries,
23+
a.datas,
24+
[],
25+
name='optimuspy',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
upx_exclude=[],
31+
runtime_tmpdir=None,
32+
console=True,
33+
disable_windowed_traceback=False,
34+
argv_emulation=False,
35+
target_arch=None,
36+
codesign_identity=None,
37+
entitlements_file=None,
38+
)

0 commit comments

Comments
 (0)