Build macOS bundled dylibs #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build macOS bundled libs (GLFW + GLEW) | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-arm64: | |
| runs-on: macos-latest # arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install GLFW and GLEW | |
| run: | | |
| export HOMEBREW_NO_REQUIRE_TAP_TRUST=1 | |
| brew install glfw glew | |
| - name: Collect and fix dylib install names | |
| run: | | |
| mkdir -p libs/macos-arm64 | |
| GLFW=$(brew --prefix glfw)/lib/libglfw.3.dylib | |
| cp "$GLFW" libs/macos-arm64/libglfw.3.dylib | |
| install_name_tool -id @rpath/libglfw.3.dylib libs/macos-arm64/libglfw.3.dylib | |
| GLEW_VER=$(ls $(brew --prefix glew)/lib/libGLEW.*.dylib | head -1) | |
| GLEW_BASE=$(basename "$GLEW_VER") | |
| cp "$GLEW_VER" libs/macos-arm64/$GLEW_BASE | |
| install_name_tool -id @rpath/$GLEW_BASE libs/macos-arm64/$GLEW_BASE | |
| cp "$GLEW_VER" libs/macos-arm64/libGLEW.dylib | |
| install_name_tool -id @rpath/libGLEW.dylib libs/macos-arm64/libGLEW.dylib | |
| echo "=== arm64 libs ===" | |
| file libs/macos-arm64/*.dylib | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-arm64-libs | |
| path: libs/macos-arm64/ | |
| build-x64: | |
| runs-on: macos-13 # last Intel runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install GLFW and GLEW | |
| run: | | |
| export HOMEBREW_NO_REQUIRE_TAP_TRUST=1 | |
| export NONINTERACTIVE=1 | |
| brew untap aws/tap 2>/dev/null || true | |
| brew install --quiet glfw glew | |
| timeout-minutes: 15 | |
| - name: Collect and fix dylib install names | |
| run: | | |
| mkdir -p libs/macos-x64 | |
| GLFW=$(brew --prefix glfw)/lib/libglfw.3.dylib | |
| cp "$GLFW" libs/macos-x64/libglfw.3.dylib | |
| install_name_tool -id @rpath/libglfw.3.dylib libs/macos-x64/libglfw.3.dylib | |
| GLEW_VER=$(ls $(brew --prefix glew)/lib/libGLEW.*.dylib | head -1) | |
| GLEW_BASE=$(basename "$GLEW_VER") | |
| cp "$GLEW_VER" libs/macos-x64/$GLEW_BASE | |
| install_name_tool -id @rpath/$GLEW_BASE libs/macos-x64/$GLEW_BASE | |
| cp "$GLEW_VER" libs/macos-x64/libGLEW.dylib | |
| install_name_tool -id @rpath/libGLEW.dylib libs/macos-x64/libGLEW.dylib | |
| echo "=== x64 libs ===" | |
| file libs/macos-x64/*.dylib | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-x64-libs | |
| path: libs/macos-x64/ | |
| commit: | |
| needs: [build-arm64, build-x64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-arm64-libs | |
| path: libs/macos-arm64/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-x64-libs | |
| path: libs/macos-x64/ | |
| - name: Commit to repo | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add libs/macos-arm64/ libs/macos-x64/ | |
| git diff --staged --quiet || git commit -m "ci: update bundled macOS arm64+x64 GLFW+GLEW dylibs" | |
| git push |