name: 🤖 Build Android on: push: branches: - "**" paths: - "apps/mobile/**" - "pnpm-lock.yaml" workflow_dispatch: inputs: profile: type: choice default: preview options: - preview - production description: "Build profile" release: type: boolean default: false description: "Create a release draft for the build" concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.profile }} cancel-in-progress: true jobs: build: name: Build Android apk for device if: github.secret_source != 'None' runs-on: ubuntu-latest steps: - name: 📦 Checkout code uses: actions/checkout@v5 - name: 📦 Setup pnpm uses: pnpm/action-setup@v4 - name: 🏗 Setup Node.js uses: actions/setup-node@v6 with: node-version: 22 cache: "pnpm" - name: Set up JDK 17 uses: actions/setup-java@v5 with: java-version: "17" distribution: "zulu" - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: 📱 Setup EAS uses: expo/expo-github-action@v8 with: eas-version: latest token: ${{ secrets.EXPO_TOKEN }} - name: Install dependencies run: pnpm install - name: 🔨 Build Android app working-directory: apps/mobile run: eas build --platform android --profile ${{ github.event.inputs.profile || 'preview' }} --local --output=${{ github.workspace }}/build.${{ github.event.inputs.profile == 'production' && 'aab' || 'apk' }} - name: 📤 Upload apk Artifact if: github.event.inputs.profile != 'production' uses: actions/upload-artifact@v4 with: name: app-android path: ${{ github.workspace }}/build.apk retention-days: 90 - name: 📤 Upload aab Artifact if: github.event.inputs.profile == 'production' uses: actions/upload-artifact@v4 with: name: aab-android path: ${{ github.workspace }}/build.aab retention-days: 90 - name: Submit to Google Play if: github.event.inputs.profile == 'production' working-directory: apps/mobile run: eas submit --platform android --path ${{ github.workspace }}/build.aab --non-interactive - name: Setup Version if: github.event.inputs.release == 'true' id: version uses: ./.github/actions/setup-version with: type: "mobile" - name: Create Release Draft if: github.event.inputs.release == 'true' uses: softprops/action-gh-release@v2 with: name: Mobile v${{ steps.version.outputs.APP_VERSION }} draft: false prerelease: true tag_name: mobile/v${{ steps.version.outputs.APP_VERSION }} # .aab cannot be installed directly on your Android Emulator or device. files: ${{ github.workspace }}/build.apk