4646 }
4747 }
4848
49- - name : Install SFML via vcpkg (Windows)
49+ - name : Install SFML via vcpkg (Windows)
5050 shell : pwsh
5151 run : |
5252 $env:VCPKG_ROOT = "${{ runner.temp }}\vcpkg"
@@ -72,17 +72,21 @@ jobs:
7272 - name : Build (Release)
7373 run : cmake --build build --config Release -- /m
7474
75- - name : Package Windows artifacts
75+ - name : Package Windows artifacts (copy exe + SFML DLLs)
7676 shell : pwsh
7777 run : |
7878 $out = "build\artifacts_windows"
7979 Remove-Item -Recurse -Force $out -ErrorAction SilentlyContinue
8080 New-Item -ItemType Directory -Path $out | Out-Null
81+ # copy exe + any generated files
8182 Copy-Item -Path "build\bin\Release\*" -Destination $out -Recurse -Force -ErrorAction SilentlyContinue
82- if (Test-Path "build\bin") {
83- Copy-Item -Path "build\bin\*" -Destination $out -Recurse -Force -ErrorAction SilentlyContinue
83+ # copy SFML dlls from vcpkg installed location (if present)
84+ $vroot = "${{ runner.temp }}\vcpkg"
85+ $sfmbin = Join-Path $vroot "installed\x64-windows\bin"
86+ if (Test-Path $sfmbin) {
87+ Copy-Item -Path (Join-Path $sfmbin "*") -Destination $out -Recurse -Force -ErrorAction SilentlyContinue
8488 }
85- Compress-Archive -Path $out\* -DestinationPath build\ IsometricGrid-SFML-windows.zip -Force
89+ Compress-Archive -Path $out\* -DestinationPath build/ IsometricGrid-SFML-windows.zip -Force
8690
8791 - name : Upload artifact (Windows)
8892 uses : actions/upload-artifact@v4
@@ -96,6 +100,11 @@ jobs:
96100 steps :
97101 - uses : actions/checkout@v4
98102
103+ - name : Install system deps for SFML build
104+ run : |
105+ sudo apt-get update
106+ sudo apt-get install -y libx11-dev libxi-dev libxrandr-dev libxcursor-dev libudev-dev libgl1-mesa-dev libasound2-dev
107+
99108 - name : Cache vcpkg
100109 uses : actions/cache@v4
101110 with :
@@ -113,7 +122,7 @@ jobs:
113122 cd "$VCPKG_ROOT"
114123 ./bootstrap-vcpkg.sh || (sleep 5 && ./bootstrap-vcpkg.sh) || (sleep 10 && ./bootstrap-vcpkg.sh)
115124
116- - name : Install SFML via vcpkg (Linux)
125+ - name : Install SFML via vcpkg (Linux)
117126 run : |
118127 export VCPKG_ROOT="${RUNNER_TEMP}/vcpkg"
119128 "$VCPKG_ROOT/vcpkg" install sfml:x64-linux
@@ -154,25 +163,28 @@ jobs:
154163 restore-keys : |
155164 vcpkg-${{ runner.os }}-
156165
157- - name : Setup vcpkg (macOS)
166+ - name : Setup vcpkg (macOS) and choose triplet
158167 run : |
159168 VCPKG_ROOT="${RUNNER_TEMP}/vcpkg"
160169 if [ ! -d "$VCPKG_ROOT" ]; then
161170 git clone https://github.com/microsoft/vcpkg "$VCPKG_ROOT"
162171 fi
163172 cd "$VCPKG_ROOT"
164173 ./bootstrap-vcpkg.sh || (sleep 5 && ./bootstrap-vcpkg.sh) || (sleep 10 && ./bootstrap-vcpkg.sh)
165-
166- - name : Install SFML via vcpkg (macOS)
167- run : |
168- VCPKG_ROOT="${RUNNER_TEMP}/vcpkg"
169- "$VCPKG_ROOT/vcpkg" install sfml:x64-osx
174+ ARCH=$(uname -m)
175+ if [ "$ARCH" = "arm64" ]; then
176+ TRIPLET=arm64-osx
177+ else
178+ TRIPLET=x64-osx
179+ fi
180+ echo "TRIPLET=$TRIPLET" >> $GITHUB_ENV
181+ "$VCPKG_ROOT/vcpkg" install sfml:${TRIPLET}
170182
171183 - name : Configure CMake (macOS)
172184 run : |
173185 VCPKG_ROOT="${RUNNER_TEMP}/vcpkg"
174186 TOOLCHAIN="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
175- cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" -DVCPKG_TARGET_TRIPLET=x64-osx -DCMAKE_BUILD_TYPE=Release
187+ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" -DVCPKG_TARGET_TRIPLET=${TRIPLET} -DCMAKE_BUILD_TYPE=Release
176188
177189 - name : Build (Release)
178190 run : cmake --build build --config Release -- -j$(sysctl -n hw.ncpu)
@@ -191,31 +203,33 @@ jobs:
191203 path : build/IsometricGrid-SFML-macos.zip
192204
193205 create-release :
194- name : Create release (on tag)
206+ name : Create release (on tag) and upload available artifacts
195207 runs-on : ubuntu-latest
196- needs :
197- - build-windows
198- - build-linux
199- - build-macos
200208 if : startsWith(github.ref, 'refs/tags/v')
201209 steps :
202- - name : Download Windows artifact
210+ - name : Checkout
211+ uses : actions/checkout@v4
212+
213+ - name : Download Windows artifact (if exists)
203214 uses : actions/download-artifact@v4
204215 with :
205216 name : IsometricGrid-SFML-windows
206217 path : release-artifacts/windows
218+ continue-on-error : true
207219
208- - name : Download Linux artifact
220+ - name : Download Linux artifact (if exists)
209221 uses : actions/download-artifact@v4
210222 with :
211223 name : IsometricGrid-SFML-linux
212224 path : release-artifacts/linux
225+ continue-on-error : true
213226
214- - name : Download macOS artifact
227+ - name : Download macOS artifact (if exists)
215228 uses : actions/download-artifact@v4
216229 with :
217230 name : IsometricGrid-SFML-macos
218231 path : release-artifacts/macos
232+ continue-on-error : true
219233
220234 - name : Create GitHub Release
221235 id : create_release
@@ -228,26 +242,25 @@ jobs:
228242 env :
229243 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
230244
231- - name : Upload Windows asset
232- uses : actions/upload-release-asset@v1
233- with :
234- upload_url : ${{ steps.create_release.outputs.upload_url }}
235- asset_path : release-artifacts/windows
236- asset_name : IsometricGrid-SFML-windows.zip
237- asset_content_type : application/zip
238-
239- - name : Upload Linux asset
240- uses : actions/upload- release-asset@v1
241- with :
242- upload_url : ${{ steps.create_release.outputs.upload_url }}
243- asset_path : release- artifacts/linux
244- asset_name : IsometricGrid-SFML-linux.zip
245- asset_content_type : application/zip
245+ - name : Upload available artifacts to GitHub Release
246+ env :
247+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
248+ UPLOAD_URL : ${{ steps.create_release.outputs.upload_url }}
249+ run : |
250+ set -e
251+ FILES=()
252+ if [ -f "release-artifacts/windows/IsometricGrid-SFML-windows.zip" ]; then FILES+=("release-artifacts/windows/IsometricGrid-SFML-windows.zip"); fi
253+ if [ -f "release-artifacts/linux/IsometricGrid-SFML-linux.zip" ]; then FILES+=("release-artifacts/linux/IsometricGrid-SFML-linux.zip"); fi
254+ if [ -f "release-artifacts/macos/IsometricGrid-SFML-macos.zip" ]; then FILES+=(" release-artifacts/macos/IsometricGrid-SFML-macos.zip"); fi
255+
256+ if [ ${#FILES[@]} -eq 0 ]; then
257+ echo "No artifacts found to upload."
258+ exit 0
259+ fi
246260
247- - name : Upload macOS asset
248- uses : actions/upload-release-asset@v1
249- with :
250- upload_url : ${{ steps.create_release.outputs.upload_url }}
251- asset_path : release-artifacts/macos
252- asset_name : IsometricGrid-SFML-macos.zip
253- asset_content_type : application/zip
261+ for f in "${FILES[@]}"; do
262+ fname=$(basename "$f")
263+ echo "Uploading $fname ..."
264+ curl --fail -s -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/zip" --data-binary @"$f" "${UPLOAD_URL}?name=${fname}" \
265+ || { echo "Upload failed for $fname"; exit 1; }
266+ done
0 commit comments