Build Android APK #17
Workflow file for this run
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 Android APK | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: "Release tag to attach APK to (optional)" | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-android: | |
| name: Build Android APK | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Typecheck | |
| run: bunx tsc --noEmit | |
| - name: Prebuild Android project | |
| run: bunx expo prebuild --platform android --clean | |
| - name: Build Release APK | |
| run: | | |
| cd android | |
| chmod +x gradlew | |
| ./gradlew assembleRelease \ | |
| -Dorg.gradle.jvmargs="-Xmx4g" \ | |
| -Dorg.gradle.parallel=true | |
| - name: Collect and rename APKs | |
| run: | | |
| VERSION="${GITHUB_REF_NAME:-${{ github.event.inputs.release_tag || 'dev' }}}" | |
| mkdir -p apk-output | |
| for apk in $(find android/app/build/outputs/apk/release -name "*.apk"); do | |
| filename=$(basename "$apk") | |
| cp "$apk" "apk-output/FAIRWallet-${VERSION}.apk" | |
| done | |
| echo "=== Built APKs ===" | |
| ls -lh apk-output/ | |
| - name: Upload APKs as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FAIRWallet-APK | |
| path: apk-output/*.apk | |
| retention-days: 90 | |
| - name: Attach APKs to Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: apk-output/*.apk | |
| - name: Attach APKs to Release (manual trigger) | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.release_tag }} | |
| files: apk-output/*.apk |