Actually build libraries on macos-15 #101
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: CI | |
| on: [push, pull_request] | |
| env: | |
| VCPKG_COMMIT_HASH: dd3097e305afa53f7b4312371f62058d2e665320 | |
| jobs: | |
| get_version: | |
| name: Get version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Get the version | |
| id: get_version | |
| run: | | |
| # check if git ref matches a tag | |
| if [[ "$GITHUB_REF" =~ "refs/tags/v" ]]; then | |
| TAG=${GITHUB_REF/refs\/tags\/v/} | |
| echo setting output to tag $TAG | |
| echo "version=$TAG" >> "$GITHUB_OUTPUT" | |
| else | |
| # set version to sha1 of the commit | |
| echo setting output to $GITHUB_SHA | |
| echo "version=$GITHUB_SHA" >> $GITHUB_OUTPUT | |
| fi | |
| echo Output: \"$GITHUB_OUTPUT\" | |
| windows: | |
| name: Windows | |
| runs-on: windows-latest | |
| needs: get_version | |
| if: always() | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - triplet: x86-windows-static | |
| - triplet: x64-windows-static | |
| - triplet: arm64-windows-static | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: lukka/get-cmake@latest | |
| - name: Install vcpkg and packages | |
| uses: lukka/run-vcpkg@v11 | |
| id: runvcpkg | |
| env: | |
| VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} | |
| VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed/${{ matrix.triplet }} | |
| with: | |
| vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_HASH }}' | |
| runVcpkgInstall: true | |
| - name: Zip stuff | |
| run: | | |
| pushd ${{ github.workspace }}/vcpkg/installed/${{ matrix.triplet }}/${{ matrix.triplet }} | |
| 7z a -tzip -mx9 -mtc=off ../../openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip "*" | |
| popd | |
| - name: Export checksum info for release notes | |
| run: | | |
| pushd ${{ github.workspace }}/vcpkg | |
| sha256sum installed/openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip > ../openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip.sha256 | |
| popd | |
| - name: Upload zipped libraries as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip | |
| path: ${{ github.workspace }}/vcpkg/installed/openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip | |
| - name: Upload sha256 as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip.sha256 | |
| path: ${{ github.workspace }}/openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}.zip.sha256 | |
| macos-build: | |
| name: macOS | |
| runs-on: macos-15 | |
| needs: get_version | |
| if: always() | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - triplet: arm64-osx-openrct2 | |
| - triplet: x64-osx-openrct2 | |
| steps: | |
| # needed for vcpkg.json | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install prerequisites | |
| shell: bash | |
| run: | | |
| brew install automake autoconf-archive | |
| - uses: lukka/get-cmake@latest | |
| - name: Install vcpkg and packages | |
| uses: lukka/run-vcpkg@v11 | |
| id: runvcpkg | |
| env: | |
| VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} | |
| VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed/${{ matrix.triplet }} | |
| with: | |
| vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_HASH }}' | |
| runVcpkgInstall: true | |
| # needed for --overlay-triplets option | |
| runVcpkgFormatString: '[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--overlay-triplets=.`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`]' | |
| - name: Zip stuff | |
| run: | | |
| pushd ${{ github.workspace }}/vcpkg/installed/${{ matrix.triplet }} | |
| zip -rXy ../openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}-macos-dylibs.zip * -x '*/.*' | |
| - name: Upload zip as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}-macos-dylibs.zip | |
| path: ${{ github.workspace }}/vcpkg/installed/openrct2-libs-v${{ needs.get_version.outputs.version }}-${{ matrix.triplet }}-macos-dylibs.zip | |
| macos-package: | |
| name: macOS package universal library | |
| runs-on: macos-15 | |
| needs: [macos-build, get_version] | |
| if: always() | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: openrct2-libs-v*-macos-dylibs.zip | |
| - name: Create Universal Library | |
| env: | |
| version: ${{ needs.get_version.outputs.version }} | |
| run: | | |
| unzip -qo openrct2-libs-v${{ needs.get_version.outputs.version }}-arm64-osx-openrct2-macos-dylibs.zip/openrct2-libs-v${{ needs.get_version.outputs.version }}-arm64-osx-openrct2-macos-dylibs.zip | |
| unzip -qo openrct2-libs-v${{ needs.get_version.outputs.version }}-x64-osx-openrct2-macos-dylibs.zip/openrct2-libs-v${{ needs.get_version.outputs.version }}-x64-osx-openrct2-macos-dylibs.zip | |
| ./macos_build.sh | |
| - name: Upload zip as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openrct2-libs-v${{ needs.get_version.outputs.version }}-universal-macos-dylibs.zip | |
| path: openrct2-libs-v${{ needs.get_version.outputs.version }}-universal-macos-dylibs.zip | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [windows, macos-package, get_version] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Concatenate sha256 files | |
| run: | | |
| ls -lR | |
| pushd ${{ github.workspace }} | |
| sha256sum openrct2-libs-v${{ needs.get_version.outputs.version }}-*.zip > openrct2-libs-v${{ needs.get_version.outputs.version }}-sha256sums.txt | |
| popd | |
| - name: Create release notes | |
| run: | | |
| echo "Release notes for version ${{ needs.get_version.outputs.version }}" > release_notes.txt | |
| echo "" >> release_notes.txt | |
| echo "SHA256 checksums:" >> release_notes.txt | |
| echo "\`\`\`" >> release_notes.txt | |
| cat openrct2-libs-v${{ needs.get_version.outputs.version }}-sha256sums.txt >> release_notes.txt | |
| echo "\`\`\`" >> release_notes.txt | |
| echo "" >> release_notes.txt | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| openrct2-libs-v${{ needs.get_version.outputs.version }}-sha256sums.txt | |
| openrct2-libs-v${{ needs.get_version.outputs.version }}-*.zip | |
| body_path: release_notes.txt |