11name : Build & Latest Release (Linux + Windows)
22
3- # ######################################################################
4- # 1) Triggers
5- # ######################################################################
63on :
74 pull_request :
8- branches : [ master ] # CI feedback on PRs
5+ branches : [ master ]
96 push :
10- branches : [ master ] # each commit to master → new “Latest”
11- workflow_dispatch : # manual button
7+ branches : [ master ]
8+ workflow_dispatch :
129
13- # ######################################################################
14- # 2) Permissions – required for creating / overwriting a release
15- # ######################################################################
1610permissions :
1711 contents : write
1812
19- # ######################################################################
20- # 3) Build & test matrix (runs for PRs *and* pushes)
21- # ######################################################################
2213jobs :
2314 # ───────────────────────────────────────────────────────── build ──
2415 build :
16+ env : # make the short SHA available to all steps
17+ SHORT_SHA : ${{ github.sha }}
2518 strategy :
2619 matrix :
2720 include :
28- # Linux leg
2921 - os : ubuntu-22.04
3022 cfg : linux-release
3123 build : linux-build
3224 isLinux : true
33- # Windows leg
3425 - os : windows-2022
3526 cfg : windows-release
3627 build : windows-build
@@ -39,112 +30,79 @@ jobs:
3930 runs-on : ${{ matrix.os }}
4031
4132 steps :
42- # 3- 1) Checkout sources
33+ # 1) checkout & dependencies (unchanged) ──────────────────────────
4334 - uses : actions/checkout@v4
35+ # … your Install-packages / MSVC / unzip steps unchanged …
4436
45- # 3-2) OS-specific dependencies
46- - name : Install packages (apt)
47- if : matrix.isLinux
48- run : |
49- sudo apt-get update -y
50- sudo apt-get install -y --no-install-recommends \
51- clang ninja-build cmake build-essential \
52- libxmu-dev libxi-dev libxinerama-dev libxrandr-dev \
53- libxcursor-dev libudev-dev libopenal-dev unixodbc-dev \
54- libgl1-mesa-dev libxxf86vm-dev zlib1g-dev
55-
56- - name : Set up MSVC env
57- if : matrix.os == 'windows-2022'
58- uses : ilammy/msvc-dev-cmd@v1
59- with : { arch: x64 }
60-
61- - name : Verify Ninja is on PATH
62- run : ninja --version
63-
64- # 3-3) Unpack engine artifacts (if needed)
65- - name : Unzip Engine files (Linux)
66- if : matrix.isLinux
67- run : |
68- unzip -q assets/Engine.zip -d assets
69- unzip -q third_party/EE/Engine.zip -d third_party/EE
70-
71- - name : Unzip Engine files (Windows)
72- if : matrix.os == 'windows-2022'
73- shell : pwsh
74- run : |
75- Expand-Archive -Path assets/Engine.zip -DestinationPath assets -Force
76- Get-ChildItem third_party/EE -Filter '*.zip' |
77- ForEach-Object { Expand-Archive -Path $_.FullName -DestinationPath third_party/EE -Force }
78-
79- # 3-4) Configure → build → unit-test
37+ # 2) configure → build → ctest (unchanged) ───────────────────────
8038 - name : Configure
8139 run : cmake --preset ${{ matrix.cfg }}
82-
8340 - name : Build
8441 run : cmake --build --preset ${{ matrix.build }}
85-
8642 - name : Run unit tests
8743 run : ctest --test-dir out/build/${{ matrix.cfg }} --output-on-failure
8844
89- # 3-5) Package runtime payload into out/dist
90- - name : Package artifact (Linux)
45+ # 3) package files, then create platform-specific archive ─────────
46+ - name : Package & archive (Linux)
9147 if : matrix.isLinux
9248 run : |
49+ set -euo pipefail
9350 STAGE=out/dist
9451 mkdir -p "$STAGE/Bin"
52+
9553 cp "out/build/${{ matrix.cfg }}/apps/client/client" "$STAGE/client"
9654 cp "out/build/${{ matrix.cfg }}/apps/server/server" "$STAGE/server"
97- cp assets/Engine.pak "$STAGE/Bin/Engine.pak"
98- cp assets/Project.pak "$STAGE/Bin/Project.pak"
55+ cp assets/Engine.pak "$STAGE/Bin/Engine.pak"
56+ cp assets/Project.pak "$STAGE/Bin/Project.pak"
9957
100- - name : Package artifact (Windows)
58+ tar -czf "linux_binaries_${SHORT_SHA::8}.tar.gz" -C "$STAGE" .
59+ - name : Package & archive (Windows)
10160 if : matrix.os == 'windows-2022'
10261 shell : pwsh
10362 run : |
10463 $Stage = "out/dist"
105- New-Item -ItemType Directory -Force -Path "$Stage/Bin" | Out-Null
64+ New-Item "$Stage/Bin" -ItemType Directory -Force | Out-Null
65+
10666 Copy-Item "out/build/${{ matrix.cfg }}/apps/client/client.exe" "$Stage/client.exe"
10767 Copy-Item "out/build/${{ matrix.cfg }}/apps/server/server.exe" "$Stage/server.exe"
108- Copy-Item "assets/Engine.pak" "$Stage/Bin/Engine.pak"
109- Copy-Item "assets/Project.pak" "$Stage/Bin/Project.pak"
68+ Copy-Item "assets/Engine.pak" "$Stage/Bin/Engine.pak"
69+ Copy-Item "assets/Project.pak" "$Stage/Bin/Project.pak"
70+
71+ Compress-Archive -Path "$Stage/*" -DestinationPath "windows_binaries_${env:SHORT_SHA:0:8}.zip"
11072
111- # 3-6) Upload artifact (GitHub auto-zips out/dist)
112- - name : Upload artifact
73+ # 4) upload just the finished archive as the artifact ─────────────
74+ - name : Upload platform archive
11375 uses : actions/upload-artifact@v4
11476 with :
115- name : BasicAppCmake-${{ matrix.os }} # one zip per platform
116- path : out/dist
77+ name : binaries-${{ matrix.os }}
78+ path : |
79+ linux_binaries_*.tar.gz
80+ windows_binaries_*.zip
11781 retention-days : 2
11882
119- # ######################################################################
120- # 4) Rolling “Latest” release (only on pushes to master)
121- # ######################################################################
83+ # ───────────────────────────────────────────────────── release ──
12284 release :
12385 needs : build
12486 if : github.event_name == 'push' && github.ref == 'refs/heads/master'
12587 runs-on : ubuntu-latest
12688
12789 steps :
128- # 4-1) Checkout (required by the release action)
12990 - uses : actions/checkout@v4
13091
131- # 4-2) Download all build artifacts
132- - name : Download build artifacts
92+ - name : Download platform archives
13393 uses : actions/download-artifact@v4
13494 with :
135- pattern : BasicAppCmake-* # both OS zips
136- merge-multiple : true
137- path : release # → release/*.zip
95+ pattern : binaries-*
96+ merge-multiple : true # puts both archives into release/
97+ path : release
13898
139- # 4-3) Prepare metadata
140- - name : Prepare metadata
99+ - name : Build release metadata
141100 id : vars
142101 run : |
143102 echo "timestamp=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_OUTPUT
144103 echo "short_sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
145104
146- # 4-4) Overwrite the single “Latest” release
147- - name : Publish rolling Latest
105+ - name : Publish Latest release
148106 uses : softprops/action-gh-release@v2
149107 with :
150108 tag_name : latest
0 commit comments