build macOS #13
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 | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-macos-intel: | |
| runs-on: macos-15-intel | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: 10.11 | |
| BINARY_NAME: gopher2600_darwin_amd64 | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| brew install go | |
| brew install sdl2 | |
| brew install dylibbundler | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from Makefile | |
| id: version | |
| run: | | |
| VERSION=$(awk -F ' = ' '/^version = / {print $2; exit}' Makefile) | |
| if [ -z "$VERSION" ]; then | |
| echo "Failed to extract version from Makefile" >&2 | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build Gopher2600 (Intel) | |
| run: make release | |
| - name: Copy executable to package | |
| run: | | |
| mkdir -p .package/Gopher2600.app/Contents/MacOS | |
| cp "$BINARY_NAME" .package/Gopher2600.app/Contents/MacOS/ | |
| - name: Set plist metadata | |
| run: | | |
| plutil -insert CFBundleExecutable -string "$BINARY_NAME" .package/Gopher2600.app/Contents/Info.plist | |
| plutil -insert CFBundleShortVersionString -string "${{ steps.version.outputs.version }}" .package/Gopher2600.app/Contents/Info.plist | |
| - name: Run dylibbundler | |
| run: | | |
| export DYLD_LIBRARY_PATH="$(brew --prefix sdl2)/lib" | |
| dylibbundler -x ".package/Gopher2600.app/Contents/MacOS/$BINARY_NAME" -b -cd -d .package/Gopher2600.app/Contents/libs | |
| - name: Zip package | |
| run: | | |
| cd .package | |
| zip -vr Gopher2600.zip Gopher2600.app | |
| - name: Upload package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Gopher2600-macOS | |
| path: .package/Gopher2600.zip | |