Skip to content

Commit 063cc03

Browse files
committed
hot fix build
1 parent d31e9c7 commit 063cc03

3 files changed

Lines changed: 45 additions & 88 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
===== FILE PATH =====
2+
./.github/workflows/build_release.yml
3+
===== FILE CONTENT =====
14
name: Build and Release
25

36
on:
@@ -10,9 +13,15 @@ permissions:
1013
jobs:
1114
build:
1215
runs-on: ${{ matrix.os }}
16+
# Global environment variables
17+
env:
18+
# Force Python to use UTF-8 encoding for console output.
19+
# This prevents "UnicodeEncodeError: 'charmap'..." when printing emojis on Windows.
20+
PYTHONUTF8: 1
21+
1322
strategy:
1423
matrix:
15-
# Ubuntu 20.04 daha geniş uyumluluk sağlar
24+
# Ubuntu 20.04 provides better binary compatibility for Linux
1625
os: [ubuntu-20.04, windows-latest]
1726

1827
steps:
@@ -30,29 +39,29 @@ jobs:
3039
pip install -r requirements.txt
3140
3241
# --- LINUX BUILD ---
33-
- name: Build (Linux)
42+
- name: Build Application (Linux)
3443
if: matrix.os == 'ubuntu-20.04'
3544
run: python build_linux.py
3645

37-
- name: Archive Linux (tar.gz)
46+
- name: Archive Linux Artifact (tar.gz)
3847
if: matrix.os == 'ubuntu-20.04'
3948
run: |
40-
# dist/DungeonMasterTool klasörünü sıkıştır
49+
# Compress the dist/DungeonMasterTool folder while preserving permissions
4150
tar -czvf DungeonMasterTool-Linux.tar.gz -C dist DungeonMasterTool
4251
4352
# --- WINDOWS BUILD ---
44-
- name: Build (Windows)
53+
- name: Build Application (Windows)
4554
if: matrix.os == 'windows-latest'
4655
run: python build_windows.py
4756

48-
- name: Archive Windows (zip)
57+
- name: Archive Windows Artifact (zip)
4958
if: matrix.os == 'windows-latest'
5059
run: |
51-
# PowerShell kullanarak zipleme
60+
# Use PowerShell to zip the distribution folder
5261
Compress-Archive -Path dist\DungeonMasterTool -DestinationPath DungeonMasterTool-Windows.zip
5362
54-
# --- ARTIFACT BELİRLEME ---
55-
- name: Set Artifact Path
63+
# --- ARTIFACT PATH RESOLUTION ---
64+
- name: Determine Artifact Path
5665
id: set_artifact
5766
shell: bash
5867
run: |
@@ -62,8 +71,8 @@ jobs:
6271
echo "path=DungeonMasterTool-Windows.zip" >> $GITHUB_OUTPUT
6372
fi
6473
65-
# --- YÜKLEME (RELEASE UPLOAD) ---
66-
- name: Upload Release Asset
74+
# --- RELEASE UPLOAD ---
75+
- name: Upload Release Assets
6776
uses: softprops/action-gh-release@v2
6877
if: startsWith(github.ref, 'refs/tags/')
6978
with:

build_linux.py

Lines changed: 19 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,19 @@
1-
import PyInstaller.__main__
2-
import os
3-
import shutil
4-
5-
APP_NAME = "DungeonMasterTool"
6-
7-
# Temizlik
8-
if os.path.exists("dist"): shutil.rmtree("dist")
9-
if os.path.exists("build"): shutil.rmtree("build")
10-
11-
# 1. PyInstaller Parametreleri
12-
params = [
13-
'main.py',
14-
f'--name={APP_NAME}',
15-
'--onedir',
16-
'--noconsole',
17-
'--clean',
18-
'--noupx',
19-
20-
# Gerekli kütüphaneler
21-
'--hidden-import=PyQt6.QtWebEngineWidgets',
22-
'--hidden-import=PyQt6.QtWebEngineCore',
23-
'--hidden-import=PyQt6.QtPrintSupport',
24-
'--hidden-import=PyQt6.QtNetwork',
25-
'--hidden-import=requests',
26-
'--hidden-import=i18n',
27-
'--hidden-import=yaml',
28-
'--hidden-import=json',
29-
]
30-
31-
print(f"🔨 Building {APP_NAME} for Linux...")
32-
PyInstaller.__main__.run(params)
33-
34-
# 2. Klasörleri Kopyala
35-
target_dir = os.path.join("dist", APP_NAME)
36-
folders_to_copy = ["assets", "themes", "locales"]
37-
38-
print("\n📂 Copying external resources...")
39-
for folder in folders_to_copy:
40-
src = os.path.join(".", folder)
41-
dst = os.path.join(target_dir, folder)
42-
43-
if os.path.exists(src):
44-
if os.path.exists(dst):
45-
shutil.rmtree(dst)
46-
shutil.copytree(src, dst)
47-
print(f" ✅ Copied: {folder}")
48-
else:
49-
print(f" ⚠️ Warning: Source folder not found: {folder}")
50-
51-
# 3. İzinleri Ayarla
52-
binary_path = os.path.join(target_dir, APP_NAME)
53-
if os.path.exists(binary_path):
54-
os.chmod(binary_path, 0o755)
55-
print(f" ✅ Permissions set for executable.")
56-
57-
print("-" * 30)
58-
print(f"🎉 SUCCESS! Build available at: {target_dir}")
1+
name: Build and Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
# Emojilerin Windows terminalinde çökmemesi için global UTF-8 ayarı
14+
env:
15+
PYTHONUTF8: 1
16+
strategy:
17+
matrix:
18+
os: [ubuntu-20.04, windows-latest]
19+
# ... (Geri kalan adımlar aynı kalacak)

build_windows.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44

55
APP_NAME = "DungeonMasterTool"
66

7-
# Temizlik
7+
# Clean
88
if os.path.exists("dist"): shutil.rmtree("dist")
99
if os.path.exists("build"): shutil.rmtree("build")
1010

11-
# 1. PyInstaller Parametreleri
12-
# --onedir: Tek klasör oluşturur.
13-
# Not: --add-data kullanmıyoruz, klasörleri aşağıda manuel kopyalayacağız.
1411
params = [
1512
'main.py',
1613
f'--name={APP_NAME}',
@@ -20,7 +17,6 @@
2017
'--noupx',
2118
'--version-file=version_info.txt',
2219

23-
# Gerekli kütüphaneler
2420
'--hidden-import=PyQt6.QtWebEngineWidgets',
2521
'--hidden-import=PyQt6.QtWebEngineCore',
2622
'--hidden-import=PyQt6.QtPrintSupport',
@@ -31,29 +27,20 @@
3127
'--hidden-import=json',
3228
]
3329

34-
print(f"🔨 Building {APP_NAME} for Windows...")
30+
print(f"--- Building {APP_NAME} for Windows ---")
3531
PyInstaller.__main__.run(params)
3632

37-
# 2. Klasörleri Kopyala (Assets, Themes, Locales)
38-
# Hedef: dist/DungeonMasterTool/
3933
target_dir = os.path.join("dist", APP_NAME)
40-
4134
folders_to_copy = ["assets", "themes", "locales"]
4235

43-
print("\n📂 Copying external resources...")
36+
print("\n--- Copying external resources ---")
4437
for folder in folders_to_copy:
4538
src = os.path.join(".", folder)
4639
dst = os.path.join(target_dir, folder)
47-
4840
if os.path.exists(src):
49-
# Hedefte varsa önce sil (temiz kopya)
50-
if os.path.exists(dst):
51-
shutil.rmtree(dst)
41+
if os.path.exists(dst): shutil.rmtree(dst)
5242
shutil.copytree(src, dst)
53-
print(f" ✅ Copied: {folder}")
54-
else:
55-
print(f" ⚠️ Warning: Source folder not found: {folder}")
43+
print(f"Copied: {folder}")
5644

5745
print("-" * 30)
58-
print(f"🎉 SUCCESS! Build available at: {target_dir}")
59-
print(f" Run: {os.path.join(target_dir, APP_NAME + '.exe')}")
46+
print(f"SUCCESS: {target_dir}")

0 commit comments

Comments
 (0)