From 6d938bf7c93b3828e6b2dcf0a28ff3bf191733ec Mon Sep 17 00:00:00 2001 From: Jack Slater <903791+NuclearMonster@users.noreply.github.com> Date: Sun, 26 Oct 2025 22:11:49 -1000 Subject: [PATCH] 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 --- .github/workflows/build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab25cbe9..c2a8eac1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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'