name: build

on: [push, pull_request]

jobs:
  build-android:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        submodules: true
    - name: Setup Java 11
      uses: actions/setup-java@v2
      with:
        distribution: adopt-hotspot
        java-version: 11
        cache: gradle
    - name: Build
      run: bash ./gradlew assembleNormalDebug assembleNormalRelease assembleEmbedRelease bundleNormalRelease bundleEmbedRelease
    - name: Artifact (normal debug APK)
      uses: actions/upload-artifact@v2
      with:
        name: love-android-debug.apk
        path: app/build/outputs/apk/normal/debug/app-normal-debug.apk
    - name: Artifact (embed APK)
      uses: actions/upload-artifact@v2
      with:
        name: love-android-embed.apk
        path: app/build/outputs/apk/embed/release/app-embed-release-unsigned.apk
    - name: Artifact (normal APK)
      uses: actions/upload-artifact@v2
      with:
        name: love-android.apk
        path: app/build/outputs/apk/normal/release/app-normal-release-unsigned.apk
    - name: Artifact (embed AAB)
      uses: actions/upload-artifact@v2
      with:
        name: love-android-embed.aab
        path: app/build/outputs/bundle/embedRelease/app-embed-release.aab
    - name: Artifact (normal AAB)
      uses: actions/upload-artifact@v2
      with:
        name: love-android.aab
        path: app/build/outputs/bundle/normalRelease/app-normal-release.aab
