Skip to content

Commit d6b07a3

Browse files
committed
build: Attempt to fix tkinterdnd2 packaging
1 parent 0e223c1 commit d6b07a3

2 files changed

Lines changed: 70 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ on:
44
push:
55
branches: [ "main" ]
66
tags:
7-
- "v*" # Triggers on tags like v1.0, v2.3.4
8-
workflow_dispatch: # Allows manual triggering from GitHub UI
7+
- "v*"
8+
workflow_dispatch:
99

1010
permissions:
1111
contents: write
1212

1313
jobs:
1414
build:
15-
runs-on: windows-latest
15+
strategy:
16+
matrix:
17+
os: [windows-latest, ubuntu-latest, macos-latest]
18+
19+
runs-on: ${{ matrix.os }}
1620

1721
steps:
1822
- name: Checkout repository
@@ -26,20 +30,61 @@ jobs:
2630
- name: Install dependencies
2731
run: |
2832
python -m pip install --upgrade pip
29-
pip install Pillow tkinterdnd2 pyinstaller
33+
pip install -r requirements.txt
34+
pip install pyinstaller
35+
36+
- name: Install Linux dependencies
37+
if: runner.os == 'Linux'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y libtk8.6 tk8.6-dev
41+
3042
- name: Build Executable
31-
# --collect-all tkinterdnd2 is crucial for the drag-and-drop library to work in the exe
3243
run: |
3344
pyinstaller build.spec
45+
46+
- name: Package Release (Windows)
47+
if: runner.os == 'Windows'
48+
run: |
49+
Compress-Archive -Path dist/BZ98R_ModManager -DestinationPath BZ98R_ModManager-windows.zip
50+
51+
- name: Package Release (Linux)
52+
if: runner.os == 'Linux'
53+
run: |
54+
tar -czvf BZ98R_ModManager-linux.tar.gz -C dist BZ98R_ModManager
55+
56+
- name: Package Release (macOS)
57+
if: runner.os == 'macOS'
58+
run: |
59+
tar -czvf BZ98R_ModManager-macos.tar.gz -C dist BZ98R_ModManager
60+
3461
- name: Upload Artifact
3562
uses: actions/upload-artifact@v4
3663
with:
37-
name: BZ98R_ModManager
38-
path: dist/BZ98R_ModManager.exe
64+
name: BZ98R_ModManager-${{ runner.os }}
65+
path: BZ98R_ModManager-*.zip
66+
if-no-files-found: ignore
67+
68+
- name: Upload Artifact (Tar)
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: BZ98R_ModManager-${{ runner.os }}
72+
path: BZ98R_ModManager-*.tar.gz
73+
if-no-files-found: ignore
74+
75+
release:
76+
needs: build
77+
runs-on: ubuntu-latest
78+
if: startsWith(github.ref, 'refs/tags/')
79+
80+
steps:
81+
- name: Download all artifacts
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: artifacts
3985

4086
- name: Create Release
41-
if: startsWith(github.ref, 'refs/tags/')
4287
uses: softprops/action-gh-release@v2
4388
with:
44-
files: dist/BZ98R_ModManager.exe
89+
files: artifacts/**/*
4590
generate_release_notes: true

build.spec

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- mode: python ; coding: utf-8 -*-
2+
from PyInstaller.utils.hooks import collect_data_files
23

34
a = Analysis(
45
['cmd.py'],
@@ -15,13 +16,15 @@ a = Analysis(
1516
('LICENSE', '.'),
1617
('README.md', '.')
1718
],
18-
hiddenimports=['PIL', 'tkinterdnd2'],
19+
hiddenimports=['PIL'],
1920
hookspath=[],
2021
hooksconfig={},
2122
runtime_hooks=[],
2223
excludes=[],
2324
noarchive=False,
2425
)
26+
a.datas += collect_data_files('tkinterdnd2')
27+
2528
pyz = PYZ(a.pure)
2629

2730
exe = EXE(
@@ -30,7 +33,7 @@ exe = EXE(
3033
[],
3134
exclude_binaries=True,
3235
name='BZ98R_ModManager',
33-
debug=False,
36+
debug=True,
3437
bootloader_ignore_signals=False,
3538
strip=False,
3639
upx=True,
@@ -41,3 +44,14 @@ exe = EXE(
4144
codesign_identity=None,
4245
entitlements_file=None,
4346
)
47+
48+
coll = COLLECT(
49+
exe,
50+
a.binaries,
51+
a.zipfiles,
52+
a.datas,
53+
strip=False,
54+
upx=True,
55+
upx_exclude=[],
56+
name='BZ98R_ModManager',
57+
)

0 commit comments

Comments
 (0)