Files
App/.github/workflows/build-android.yml
2025-11-11 09:28:12 -06:00

80 lines
2.4 KiB
YAML

name: Build Android APK
on:
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'package.json'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-android:
runs-on: macos-15
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
- name: 🖥 Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: 💎 Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Match your local Ruby version
bundler-cache: true
- name: 💬 Echo package.json version to Github ENV
run: echo VERSION_NUMBER=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV
- name: 🔑 Decode and setup release keystore
continue-on-error: true
run: |
if [ -n "${{ secrets.ANDROID_SIGNING_BASE64 }}" ]; then
echo "${{ secrets.ANDROID_SIGNING_BASE64 }}" | base64 --decode > android/app/jellify.keystore
echo "Release keystore created"
else
echo "No keystore secret found, will use debug keystore"
fi
- uses: actions/cache@v3
with:
path: |
node_modules
~/.gradle/caches
~/.gradle/wrapper
~/.cache/turbo
android/.gradle
android/app/build
key: ${{ runner.os }}-gradle-turbo-${{ hashFiles('**/yarn.lock', '**/build.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-turbo-
- name: 🤖 Run yarn init-android
run: yarn install --network-concurrency 1
- name: 🚀 Run turbo build
run: yarn android-build
env:
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
- name: 📦 Upload APK for testing
uses: actions/upload-artifact@v4
if: always()
with:
name: jellify-android-pr-${{ github.event.number }}-${{ env.VERSION_NUMBER }}
path: |
android/app/build/outputs/apk/release/*.apk
retention-days: 7
if-no-files-found: warn