diff --git a/.github/workflows/build-eas-development.yml b/.github/workflows/build-eas-development.yml index 08538f5ca..2a8807353 100644 --- a/.github/workflows/build-eas-development.yml +++ b/.github/workflows/build-eas-development.yml @@ -2,13 +2,13 @@ name: Build iOS IPA for development on: push: - branches: [dev, main] + branches: [dev] paths: - "apps/mobile/web-app/**" - "apps/mobile/native/**" - "apps/mobile/package.json" pull_request: - branches: [dev, main] + branches: [dev] paths: - "apps/mobile/web-app/**" - "apps/mobile/native/**" @@ -19,18 +19,38 @@ concurrency: cancel-in-progress: true jobs: + check-runner: + runs-on: ubuntu-latest + outputs: + runner-label: ${{ steps.set-runner.outputs.runner-label }} + + steps: + - name: Set runner + id: set-runner + run: | + runners=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.RUNNER_GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners") + available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")') + if [ -n "$available" ]; then + echo "runner-label=self-hosted" >> $GITHUB_OUTPUT + else + echo "runner-label=macos-latest" >> $GITHUB_OUTPUT + fi + build: name: Build iOS IPA for device - runs-on: macos-latest + needs: check-runner + runs-on: ${{ needs.check-runner.outputs.runner-label }} steps: - name: 📦 Checkout code uses: actions/checkout@v4 - name: 📦 Setup pnpm + if: needs.check-runner.outputs.runner-label == 'macos-latest' uses: pnpm/action-setup@v4 - name: 🏗 Setup Node.js + if: needs.check-runner.outputs.runner-label == 'macos-latest' uses: actions/setup-node@v4 with: node-version: 22 diff --git a/.github/workflows/build-eas.yml b/.github/workflows/build-eas.yml index df46a0555..def54af54 100644 --- a/.github/workflows/build-eas.yml +++ b/.github/workflows/build-eas.yml @@ -26,18 +26,38 @@ concurrency: cancel-in-progress: true jobs: + check-runner: + runs-on: ubuntu-latest + outputs: + runner-label: ${{ steps.set-runner.outputs.runner-label }} + + steps: + - name: Set runner + id: set-runner + run: | + runners=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.RUNNER_GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners") + available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")') + if [ -n "$available" ]; then + echo "runner-label=self-hosted" >> $GITHUB_OUTPUT + else + echo "runner-label=macos-latest" >> $GITHUB_OUTPUT + fi + build: name: Build iOS IPA - runs-on: macos-latest + needs: check-runner + runs-on: ${{ needs.check-runner.outputs.runner-label }} steps: - name: 📦 Checkout code uses: actions/checkout@v4 - name: 📦 Setup pnpm + if: needs.check-runner.outputs.runner-label == 'macos-latest' uses: pnpm/action-setup@v4 - name: 🏗 Setup Node.js + if: needs.check-runner.outputs.runner-label == 'macos-latest' uses: actions/setup-node@v4 with: node-version: 22 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd6f1341f..0ead034b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,13 +126,13 @@ jobs: cd apps/desktop pnpm update:main-hash - name: Build - if: matrix.os != 'macos-latest' + if: runner.os != 'macOS' run: pnpm build:electron env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Build (macOS) - if: matrix.os == 'macos-latest' && github.event.inputs.mas != 'true' + if: runner.os == 'macOS' && github.event.inputs.mas != 'true' env: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} @@ -146,7 +146,7 @@ jobs: command: pnpm build:macos - name: Build (Mac App Store) - if: matrix.os == 'macos-latest' && github.event.inputs.mas == 'true' + if: runner.os == 'macOS' && github.event.inputs.mas == 'true' env: OSX_SIGN_KEYCHAIN_PATH: ${{ runner.temp }}/app-signing.keychain-db OSX_SIGN_IDENTITY: ${{ secrets.OSX_SIGN_IDENTITY_MAS }} @@ -155,7 +155,7 @@ jobs: run: pnpm build:mas - name: Build Renderer - if: matrix.os == 'ubuntu-latest' + if: runner.os == 'Linux' run: pnpm build:render env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} @@ -181,7 +181,7 @@ jobs: - name: Upload file (arm64.dmg) uses: actions/upload-artifact@v4 - if: matrix.os == 'macos-latest' + if: runner.os == 'macOS' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -192,7 +192,7 @@ jobs: - name: Upload file (pkg) uses: actions/upload-artifact@v4 - if: matrix.os == 'macos-latest' + if: runner.os == 'macOS' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 55d96f6a0..5e6e552ca 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -8,9 +8,9 @@ "bump": "vv", "db:generate": "drizzle-kit generate", "dev": "npm run start", + "eas-build-post-install": "rm -rf $TMPDIR/metro-cache", "ios": "expo run:ios", "ios:device": "expo run:ios --device", - "lint": "expo lint", "start": "expo start --dev-client", "start:clean": "expo start --dev-client --clear", "typecheck": "tsc --noEmit",