Skip to content

Recursively create universal bins #71

Recursively create universal bins

Recursively create universal bins #71

Workflow file for this run

name: CI
on: [push, pull_request]
env:
VCPKG_COMMIT_HASH: 576379156e82da642f8d1834220876759f13534d
jobs:
createrelease:
name: createrelease
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Get the version
id: get_version
run: echo "version=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
name: Release v${{ env.version }}
prerelease: false
- name: Output Release URL File
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
uses: actions/upload-artifact@v4
with:
name: release_url
path: release_url.txt
windows:
name: Windows
runs-on: windows-latest
needs: createrelease
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
- name: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: |
chcp 65001 #set code page to utf-8
echo ("version=" + $env:GITHUB_REF.replace('refs/tags/v', '')) >> $env:GITHUB_ENV
- 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${{ env.version }}-${{ matrix.triplet }}.zip "*"
popd
- name: Upload zip as artifact
uses: actions/upload-artifact@v4
with:
name: openrct2-libs-v${{ env.version }}-${{ matrix.triplet }}.zip
path: ${{ github.workspace }}/vcpkg/installed/openrct2-libs-v${{ env.version }}-${{ matrix.triplet }}.zip
- name: Load Release URL File from release job
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/download-artifact@v4
with:
name: release_url
- name: Get Release File Name & Upload URL
if: startsWith(github.ref, 'refs/tags/v')
id: get_release_info
shell: bash
run: |
value=`cat release_url.txt`
echo "upload_url=$value" >> $GITHUB_OUTPUT
- name: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/v')
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ${{ github.workspace }}/vcpkg/installed/openrct2-libs-v${{ env.version }}-${{ matrix.triplet }}.zip
asset_name: openrct2-libs-v${{ env.version }}-${{ matrix.triplet }}.zip
asset_content_type: application/zip
macos-build:
name: macOS
runs-on: macos-12
needs: createrelease
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: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "version=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- 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${{ env.version }}-${{ matrix.triplet }}-macos-dylibs.zip * -x '*/.*'
- name: Upload zip as artifact
uses: actions/upload-artifact@v4
with:
name: openrct2-libs-v${{ env.version }}-${{ matrix.triplet }}-macos-dylibs.zip
path: ${{ github.workspace }}/vcpkg/installed/openrct2-libs-v${{ env.version }}-${{ matrix.triplet }}-macos-dylibs.zip
macos-package:
name: macOS package universal library
runs-on: macos-latest
needs: macos-build
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "version=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
pattern: openrct2-libs-v*-macos-dylibs.zip
- name: Create Universal Library
run: |
unzip -qo openrct2-libs-v${{ env.version }}-arm64-osx-openrct2-macos-dylibs.zip/openrct2-libs-v${{ env.version }}-arm64-osx-openrct2-macos-dylibs.zip
unzip -qo openrct2-libs-v${{ env.version }}-x64-osx-openrct2-macos-dylibs.zip/openrct2-libs-v${{ env.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${{ env.version }}-universal-macos-dylibs.zip
path: openrct2-libs-v${{ env.version }}-universal-macos-dylibs.zip
- name: Load Release URL File from release job
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/download-artifact@v4
with:
name: release_url
- name: Get Release File Name & Upload URL
if: startsWith(github.ref, 'refs/tags/v')
id: get_release_info
shell: bash
run: |
value=`cat release_url.txt`
echo "upload_url=$value" >> $GITHUB_OUTPUT
- name: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: openrct2-libs-v${{ env.version }}-universal-macos-dylibs.zip
asset_name: openrct2-libs-v${{ env.version }}-universal-macos-dylibs.zip
asset_content_type: application/zip