57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
name: Android CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Android App
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# Step 1: Checkout the repository
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
# Step 2: Set up JDK (Java 17 is required for Android projects)
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: '17'
|
|
|
|
# Step 3: Grant execute permission for gradlew
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x ./gradlew
|
|
|
|
# Step 4: Cache Gradle dependencies
|
|
- name: Cache Gradle packages
|
|
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 5: Download Dependencies (Gradle Wrapper)
|
|
- name: Download Dependencies
|
|
run: ./gradlew --no-daemon clean build
|
|
|
|
# Step 6: Build APK
|
|
- name: Build Debug APK
|
|
run: ./gradlew --no-daemon assembleDebug
|
|
|
|
# Step 7: Upload artifact (optional)
|
|
- name: Upload APK
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: app-debug.apk
|
|
path: app/build/outputs/apk/debug/app-debug.apk
|