Update README.md #136
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: Android CI/CD | |
# Trigger the workflow on push or pull request to the main branch | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build APK | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up JDK 11 (required for Gradle) | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
# Step 3: Cache Gradle dependencies to speed up the build process | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle | |
# Step 4: Build the APK using Gradle | |
- name: Build with Gradle | |
run: ./gradlew assembleRelease | |
# Step 5: Upload the generated APK as an artifact | |
- name: Upload APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-apk | |
path: app/build/outputs/apk/release/app-release-unsigned.apk |