Skip to content

Commit 54e4326

Browse files
authored
Refactor build.yml for better OS version handling
Updated build workflow to improve cross-platform compatibility and version detection.
1 parent 9631fef commit 54e4326

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jobs:
3030
pip install -r requirements.txt
3131
pip install pyinstaller
3232
33-
# === FIX: Force bash so Windows can run [[ ]] ===
33+
# ---------------------------------------------
34+
# FIX: Make version-detection work on all OSes
35+
# ---------------------------------------------
3436
- name: Determine version
3537
id: version
3638
shell: bash
@@ -42,9 +44,13 @@ jobs:
4244
fi
4345
echo "VERSION=$VERSION" >> $GITHUB_ENV
4446
47+
# ---------------------------------------------
48+
# Build executables
49+
# ---------------------------------------------
4550
- name: Build executables
4651
shell: bash
4752
run: |
53+
set -e
4854
cd scripts
4955
rm -rf dist build __pycache__
5056
for f in *.py; do
@@ -56,23 +62,31 @@ jobs:
5662
fi
5763
done
5864
59-
- name: Package executables
65+
# ---------------------------------------------
66+
# Package executables (cross-platform)
67+
# ---------------------------------------------
68+
- name: Package executables (Windows)
69+
if: runner.os == 'Windows'
70+
shell: powershell
71+
run: |
72+
$zipPath = "MyGameUpdater-${env:VERSION}-Windows.zip"
73+
Compress-Archive -Path "scripts/dist/*" -DestinationPath $zipPath -Force
74+
75+
- name: Package executables (Linux/macOS)
76+
if: runner.os != 'Windows'
6077
shell: bash
6178
run: |
6279
cd scripts/dist
63-
OS="${{ matrix.os }}"
64-
65-
if [[ "$OS" == "windows-latest" ]]; then
66-
ZIP="../../MyGameUpdater-${VERSION}-Windows.zip"
67-
elif [[ "$OS" == "ubuntu-latest" ]]; then
80+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
6881
ZIP="../../MyGameUpdater-${VERSION}-Linux.zip"
6982
else
7083
ZIP="../../MyGameUpdater-${VERSION}-Mac.zip"
7184
fi
72-
7385
zip -r "$ZIP" ./*
7486
75-
# === FIX: Upload ONLY the zip belonging to this OS ===
87+
# ---------------------------------------------
88+
# Upload artifact (v4)
89+
# ---------------------------------------------
7690
- name: Upload artifact
7791
uses: actions/upload-artifact@v4
7892
with:

0 commit comments

Comments
 (0)