multi: fork to redwallet #11
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 Mac Catalyst | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - master | |
| types: [labeled, synchronize] | |
| concurrency: | |
| group: catalyst-build-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| if: > | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.action == 'labeled' && (github.event.label.name == 'mac-dmg' || github.event.label.name == 'testflight')) || | |
| github.event.action == 'synchronize' | |
| runs-on: macos-15 | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Check PR labels | |
| if: github.event_name == 'pull_request' | |
| id: labels | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| LABELS=$(gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" --jq '.[].name' | tr '\n' ',') | |
| echo "all=${LABELS}" >> $GITHUB_OUTPUT | |
| if [[ "$LABELS" == *"mac-dmg"* ]]; then | |
| echo "has_mac_dmg=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_mac_dmg=false" >> $GITHUB_OUTPUT | |
| fi | |
| if [[ "$LABELS" == *"testflight"* ]] && [[ "$LABELS" == *"mac-dmg"* ]]; then | |
| echo "upload_testflight=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "upload_testflight=false" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Labels on PR: ${LABELS}" | |
| - name: Skip if mac-dmg label not present | |
| if: github.event_name == 'pull_request' && steps.labels.outputs.has_mac_dmg != 'true' | |
| run: | | |
| echo "mac-dmg label not found on PR — skipping build." | |
| exit 0 | |
| - name: Checkout project | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Setup Xcode | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1 | |
| with: | |
| xcode-version: latest | |
| - name: Set up Ruby | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.4.8 | |
| bundler-cache: true | |
| - name: Set default network | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| run: ./scripts/set-network.sh signet | |
| - name: Install Node modules | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| run: npm ci | |
| - name: Install CocoaPods dependencies | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| run: bundle exec fastlane ios install_pods | |
| env: | |
| SKIP_APP_STORE_CONNECT_AUTH: '1' | |
| - name: Create temporary keychain for signing | |
| if: (github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true') && steps.labels.outputs.upload_testflight == 'true' | |
| run: | | |
| security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" build.keychain | |
| security default-keychain -s build.keychain | |
| security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" build.keychain | |
| security set-keychain-settings -t 3600 -u build.keychain | |
| - name: Build Mac Catalyst app with Fastlane | |
| if: github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true' | |
| id: build_catalyst | |
| run: bundle exec fastlane ios build_catalyst_app_lane | |
| env: | |
| SKIP_APP_STORE_CONNECT_AUTH: '1' | |
| SKIP_CLEAR_DERIVED_DATA: '1' | |
| CATALYST_SIGNING_IDENTITY: ${{ steps.labels.outputs.upload_testflight == 'true' && secrets.CATALYST_SIGNING_IDENTITY || '' }} | |
| CATALYST_TEAM_ID: ${{ steps.labels.outputs.upload_testflight == 'true' && secrets.CATALYST_TEAM_ID || '' }} | |
| GIT_URL: ${{ steps.labels.outputs.upload_testflight == 'true' && secrets.GIT_URL || '' }} | |
| GIT_ACCESS_TOKEN: ${{ steps.labels.outputs.upload_testflight == 'true' && secrets.GIT_ACCESS_TOKEN || '' }} | |
| MATCH_READONLY: ${{ steps.labels.outputs.upload_testflight == 'true' && 'false' || 'true' }} | |
| KEYCHAIN_NAME: ${{ steps.labels.outputs.upload_testflight == 'true' && 'build' || '' }} | |
| KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
| - name: Upload Mac Catalyst DMG | |
| id: upload_dmg | |
| if: success() && (github.event_name == 'workflow_dispatch' || steps.labels.outputs.has_mac_dmg == 'true') | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | |
| with: | |
| name: BlueWallet-Mac-Catalyst | |
| path: ${{ steps.build_catalyst.outputs.catalyst_dmg_path }} | |
| if-no-files-found: warn | |
| - name: Create App Store Connect API Key JSON | |
| if: success() && steps.labels.outputs.upload_testflight == 'true' | |
| run: echo '${{ secrets.APPLE_API_KEY_CONTENT }}' > ./appstore_api_key.json | |
| - name: Upload to TestFlight | |
| if: success() && steps.labels.outputs.upload_testflight == 'true' | |
| run: bundle exec fastlane ios upload_catalyst_to_testflight | |
| env: | |
| APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
| APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }} | |
| CATALYST_TEAM_ID: ${{ secrets.CATALYST_TEAM_ID }} | |
| TEAM_ID: ${{ secrets.TEAM_ID }} | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| LATEST_COMMIT_MESSAGE: ${{ github.event.pull_request.title || 'Manual build' }} | |
| - name: Cleanup App Store Connect API Key JSON | |
| if: always() && steps.labels.outputs.upload_testflight == 'true' | |
| run: rm -f ./appstore_api_key.json | |
| - name: Cleanup temporary keychain | |
| if: always() && steps.labels.outputs.upload_testflight == 'true' | |
| run: security delete-keychain build.keychain || true | |
| - name: Comment on PR with DMG link | |
| if: success() && github.event_name == 'pull_request' && steps.labels.outputs.has_mac_dmg == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| UPLOADED_TO_TF: ${{ steps.labels.outputs.upload_testflight }} | |
| run: | | |
| ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload_dmg.outputs.artifact-id }}" | |
| COMMENT_TAG="<!-- catalyst-dmg-link -->" | |
| TF_LINE="" | |
| if [[ "$UPLOADED_TO_TF" == "true" ]]; then | |
| TF_LINE=$'\n\n**Also uploaded to TestFlight.** Check [App Store Connect](https://appstoreconnect.apple.com) for the build.' | |
| fi | |
| COMMENT_FILE="$(mktemp)" | |
| { | |
| printf '%s\n' "${COMMENT_TAG}" | |
| printf '### Mac Catalyst Build\n\n' | |
| printf 'The Mac Catalyst DMG is ready for download:\n\n' | |
| printf '[Download BlueWallet-Mac-Catalyst.dmg](%s)\n' "${ARTIFACT_URL}" | |
| if [[ -n "$TF_LINE" ]]; then | |
| printf '%s\n' "${TF_LINE}" | |
| fi | |
| printf '<sub>Built from `%s`" | |
| } >"${COMMENT_FILE}" | |
| gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \ | |
| --paginate --jq '.[] | select(.body | contains("<!-- catalyst-dmg-link -->")) | .id' | \ | |
| while read -r comment_id; do | |
| gh api -X DELETE "repos/${{ github.repository }}/issues/comments/${comment_id}" || true | |
| done | |
| gh pr comment "${{ github.event.pull_request.number }}" --body-file "${COMMENT_FILE}" |