Update android-build.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Android APK | |
# Trigger the workflow on push and pull request events to the main branch | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
# Define the jobs that will run | |
jobs: | |
build: | |
# Specify the machine type | |
runs-on: ubuntu-latest | |
# Set up JDK and cache Gradle dependencies for faster builds | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
# Cache Gradle dependencies for faster builds | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle-${{ runner.os }}- | |
- name: Build with Gradle | |
run: ./gradlew assembleRelease | |
# Upload the generated APK as an artifact to download | |
- name: Upload APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release.apk | |
path: app/build/outputs/apk/release/app-release.apk |