Skip to content

Commit 0ee7296

Browse files
committed
Add GitHub Actions release workflow and update build paths
Automatically build and publish TimeTracker.exe as a GitHub release when a version tag (v*) is pushed. Update make_executable.py and spec file to reference the new package entry point.
1 parent 4330df4 commit 0ee7296

2 files changed

Lines changed: 49 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install dependencies
24+
run: |
25+
pip install pyqt5 matplotlib pyinstaller
26+
27+
- name: Build executable
28+
run: |
29+
pyinstaller `
30+
--onefile `
31+
--windowed `
32+
--name=TimeTracker `
33+
--icon=assets/icon.ico `
34+
--add-data="assets;assets" `
35+
--hidden-import=PyQt5.QtCore `
36+
--hidden-import=PyQt5.QtGui `
37+
--hidden-import=PyQt5.QtWidgets `
38+
--hidden-import=matplotlib.backends.backend_qt5agg `
39+
--hidden-import=matplotlib.figure `
40+
time_tracker/__main__.py
41+
42+
- name: Create Release
43+
uses: softprops/action-gh-release@v2
44+
with:
45+
files: dist/TimeTracker.exe
46+
generate_release_notes: true

make_executable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ def build_executable():
198198
spec_content = f.read()
199199

200200
# Replace relative paths with absolute paths
201-
time_tracker_path = os.path.join(current_dir, "time_tracker.py").replace("\\", "/")
202201
icon_path_value = (icon_file_abs if icon_file_abs else os.path.abspath(os.path.join("assets", "icon.ico"))).replace("\\", "/")
203202
data_dir_normalized = data_dir.replace("\\", "/")
204203
assets_dir_normalized = os.path.join(current_dir, "assets").replace("\\", "/")
205204

206-
spec_content = spec_content.replace("['time_tracker.py']", f"['{time_tracker_path}']")
205+
time_tracker_path = os.path.join(current_dir, "time_tracker", "__main__.py").replace("\\", "/")
206+
spec_content = spec_content.replace("['time_tracker/__main__.py']", f"['{time_tracker_path}']")
207207
spec_content = spec_content.replace("('data', 'data')", f"('{data_dir_normalized}', 'data')")
208208
spec_content = spec_content.replace("'assets/icon.ico'", f"'{icon_path_value}'")
209209

@@ -256,7 +256,7 @@ def build_executable():
256256
"--hidden-import=PyQt5.QtWidgets",
257257
"--hidden-import=matplotlib.backends.backend_qt5agg",
258258
"--hidden-import=matplotlib.figure",
259-
"time_tracker.py"
259+
"time_tracker/__main__.py"
260260
]
261261

262262
print("Building executable with PyInstaller...")

0 commit comments

Comments
 (0)