78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
name: Build Android APK
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
name: Build APK
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
cache: 'gradle'
|
|
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
|
|
- name: Build Debug APK
|
|
run: ./gradlew assembleDebug --stacktrace
|
|
|
|
- name: Build Release APK (unsigned)
|
|
run: ./gradlew assembleRelease --stacktrace
|
|
continue-on-error: true
|
|
|
|
- name: Upload Debug APK
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: app-debug
|
|
path: app/build/outputs/apk/debug/app-debug.apk
|
|
retention-days: 30
|
|
|
|
- name: Upload Release APK
|
|
uses: actions/upload-artifact@v3
|
|
if: success()
|
|
with:
|
|
name: app-release-unsigned
|
|
path: app/build/outputs/apk/release/app-release-unsigned.apk
|
|
retention-days: 30
|
|
|
|
- name: Build Summary
|
|
if: always()
|
|
run: |
|
|
echo "### Build Summary 📱" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Author:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "#### APK Files" >> $GITHUB_STEP_SUMMARY
|
|
if [ -f app/build/outputs/apk/debug/app-debug.apk ]; then
|
|
SIZE=$(du -h app/build/outputs/apk/debug/app-debug.apk | cut -f1)
|
|
echo "- ✅ Debug APK: $SIZE" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "- ❌ Debug APK: Failed" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
if [ -f app/build/outputs/apk/release/app-release-unsigned.apk ]; then
|
|
SIZE=$(du -h app/build/outputs/apk/release/app-release-unsigned.apk | cut -f1)
|
|
echo "- ✅ Release APK: $SIZE" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "- ⚠️ Release APK: Not built (needs signing)" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|