Workaround macOS dmg build error with CMake (#819)

* Workaround macOS dmg build error with CMake

Retry the macOS workflow multiple times in order to work around this issue with CMake:
https://gitlab.kitware.com/cmake/cmake/-/issues/25671

Solution stolen wholesale from SDL and @madebr
Thank you! 
https://github.com/libsdl-org/SDL/pull/9816
This commit is contained in:
Jack Slater 2025-10-26 22:11:49 -10:00 committed by GitHub
parent 170a052489
commit 6d938bf7c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -148,7 +148,22 @@ jobs:
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
cpack --config build/CPackConfig.cmake -B build/installer --verbose
# DMG creation on macOS occasionally fails, so try multiple times
# https://gitlab.kitware.com/cmake/cmake/-/issues/25671
success=0
max_tries=10
for i in $(seq $max_tries); do
cpack --config build/CPackConfig.cmake -B build/installer --verbose && success=1
if test $success = 1; then
break
fi
echo "Package creation failed. Sleep 1 second and try again."
sleep 1
done
if test $success = 0; then
echo "Package creation failed after $max_tries attempts."
exit 1
fi
mv build/installer/*.dmg build/Release
- name: Notarize
if: github.ref_name == 'main'