Skip to content

Build Android APK

Build Android APK #5

Workflow file for this run

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: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- 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: Rename APK with version
run: |
VERSION="${GITHUB_REF_NAME:-${{ github.event.inputs.release_tag || 'dev' }}}"
APK_PATH=$(find android/app/build/outputs/apk/release -name "*.apk" | head -1)
if [ -n "$APK_PATH" ]; then
cp "$APK_PATH" "FAIRWallet-${VERSION}.apk"
echo "APK_NAME=FAIRWallet-${VERSION}.apk" >> $GITHUB_ENV
echo "APK built: FAIRWallet-${VERSION}.apk"
ls -lh "FAIRWallet-${VERSION}.apk"
fi
- name: Upload APK as artifact
uses: actions/upload-artifact@v4
with:
name: FAIRWallet-APK
path: FAIRWallet-*.apk
retention-days: 90
- name: Attach APK to Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: FAIRWallet-*.apk
- name: Attach APK 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: FAIRWallet-*.apk