diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 54b6d4fc7..a9e48029e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,37 +1,44 @@ -name: Android CI + + +name: CI on: push: - branches: [ main ] pull_request: - branches: [ main ] + workflow_dispatch: jobs: build: - + name: Build apk runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - cache: gradle - - name: Setup Gradle Dependencies Cache - uses: actions/cache@v2 + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.5.0 with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + access_token: ${{ github.token }} - # Cache Gradle Wrapper - - name: Setup Gradle Wrapper Cache - uses: actions/cache@v2 + - name: Clone repo + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build + java-version: 11 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build debug apk + uses: eskatos/gradle-command-action@v1 + with: + arguments: assembleDebug + distributions-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true + + - name: Upload artifact + uses: actions/upload-artifact@v2 + if: ${{ !github.head_ref }} + with: + name: apk-debug + path: app/build/outputs/apk/debug