name: Android Build
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6

    - name: Install Deps
      run: sudo apt install ninja-build

    - name: Build
      run: |
        cd android
        echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore.jks
        JAVA_HOME=$JAVA_HOME_17_X64 ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
      env:
        KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
        KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
        KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}

    - name: Upload artifacts
      uses: actions/upload-artifact@v7
      with:
        path: android/app/build/outputs/apk/release/app-release.apk
        archive: false
