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'