|
| 1 | +name: Build - Mac (ARM) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + build_type: |
| 7 | + description: 'Build Type' |
| 8 | + default: "Debug" |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + workflow_call: |
| 12 | + inputs: |
| 13 | + version: |
| 14 | + description: 'Version' |
| 15 | + default: '' |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + build_type: |
| 19 | + description: 'Build Type' |
| 20 | + default: "Debug" |
| 21 | + required: false |
| 22 | + type: string |
| 23 | + secrets: |
| 24 | + SEED_KEY: |
| 25 | + description: 'Key used to complicate the seed string in release builds' |
| 26 | + required: false |
| 27 | + |
| 28 | +env: |
| 29 | + QT_VERSION: 6.10.1 |
| 30 | + EXTRA_CMAKE_FLAGS: "" |
| 31 | + |
| 32 | +jobs: |
| 33 | + build-desktop-application-mac-arm: |
| 34 | + name: Build Desktop Application Mac (ARM) |
| 35 | + runs-on: macos-latest |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout Repository |
| 39 | + uses: actions/checkout@v6 |
| 40 | + with: |
| 41 | + submodules: recursive |
| 42 | + fetch-depth: 0 |
| 43 | + fetch-tags: true |
| 44 | + |
| 45 | + - name: Install Qt |
| 46 | + uses: jurplel/install-qt-action@v4 |
| 47 | + with: |
| 48 | + version: '${{ env.QT_VERSION }}' |
| 49 | + host: 'mac' |
| 50 | + target: 'desktop' |
| 51 | + arch: 'clang_64' |
| 52 | + cache: true |
| 53 | + |
| 54 | + - name: Set Debug Flags |
| 55 | + if: inputs.build_type == 'Debug' |
| 56 | + run: echo "EXTRA_CMAKE_FLAGS=-DENABLE_DEBUG=True ${{ env.EXTRA_CMAKE_FLAGS }}" >> $GITHUB_ENV |
| 57 | + |
| 58 | + - name: Set Release Flags |
| 59 | + if: inputs.build_type == 'Release' && inputs.version != '' |
| 60 | + run: echo "EXTRA_CMAKE_FLAGS=-DRELEASE_TAG=${{ inputs.version }} ${{ env.EXTRA_CMAKE_FLAGS }}" >> $GITHUB_ENV |
| 61 | + |
| 62 | + - name: Configure CMake |
| 63 | + working-directory: ${{ github.workspace }} |
| 64 | + env: |
| 65 | + SEED_KEY: ${{ secrets.SEED_KEY }} |
| 66 | + run: cmake -B build -DGITHUB_WORKFLOW=True -DQT_GUI=True -DEMBED_DATA=True "${{ env.EXTRA_CMAKE_FLAGS }}" |
| 67 | + |
| 68 | + - name: Build |
| 69 | + working-directory: ${{ github.workspace }} |
| 70 | + run: cmake --build build --config ${{ inputs.build_type }} -j |
| 71 | + |
| 72 | + - name: Call macdeployqt |
| 73 | + working-directory: ${{ github.workspace }}/build |
| 74 | + run: ../../Qt/${{ env.QT_VERSION }}/macos/bin/macdeployqt wwhd_rando.app |
| 75 | + |
| 76 | + - name: Create DMG |
| 77 | + working-directory: ${{ github.workspace }}/build |
| 78 | + run: | |
| 79 | + mkdir dmg_contents |
| 80 | + cp ../gui/desktop/mac_user_instructions.txt ./dmg_contents/READ_THIS_FIRST.txt |
| 81 | + cp -R wwhd_rando.app ./dmg_contents/wwhd_rando.app |
| 82 | + echo killing...; sudo pkill -9 XProtect >/dev/null || true; |
| 83 | + echo waiting...; while pgrep XProtect; do sleep 3; done; |
| 84 | + hdiutil create -srcfolder ./dmg_contents wwhd_rando |
| 85 | +
|
| 86 | + - name: Get Version |
| 87 | + id: get-version |
| 88 | + shell: pwsh |
| 89 | + working-directory: ${{ github.workspace }}/build |
| 90 | + run: | |
| 91 | + echo "RANDO_VERSION=$(((Get-Content version.hpp | Select-String -Pattern '#define RANDOMIZER_VERSION "[0-9\.\-a-z]*"') -Replace '.*("[0-9\.\-a-z]*").*', '$1') -Replace '"', '')" >> $env:GITHUB_OUTPUT |
| 92 | +
|
| 93 | + - name: Save Artifact |
| 94 | + uses: actions/upload-artifact@v6 |
| 95 | + with: |
| 96 | + path: ${{github.workspace}}/build/wwhd_rando.dmg |
| 97 | + name: wwhd_rando_${{ steps.get-version.outputs.RANDO_VERSION }}_mac_arm.dmg |
0 commit comments