chore: 👷 add and update CI build system #344
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 Build | |
on: | |
pull_request: | |
branches: [main, android] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [main, android] | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Diagnose project structure | |
run: | | |
echo "Current directory:" | |
pwd | |
echo "Directory contents:" | |
ls -R | |
echo "Searching for gradlew:" | |
find . -name gradlew | |
- name: Set Gradle Wrapper Permissions | |
run: | | |
GRADLEW_PATH=$(find . -name gradlew | head -n 1) | |
if [ -z "$GRADLEW_PATH" ]; then | |
echo "gradlew not found. Exiting." | |
exit 1 | |
fi | |
chmod +x $GRADLEW_PATH | |
echo "GRADLEW_PATH=$GRADLEW_PATH" >> $GITHUB_ENV | |
- 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- | |
- name: Build gradle project | |
run: ${{ env.GRADLEW_PATH }} build | |
- name: Build debug APK | |
run: ${{ env.GRADLEW_PATH }} assembleDebug | |
- name: Upload debug APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-debug | |
path: '**/build/outputs/apk/debug/*.apk' | |
# release: | |
# needs: build | |
# if: github.event_name == 'release' && github.event.action == 'created' | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# - name: Set up JDK | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: '17' | |
# distribution: 'temurin' | |
# - name: Change directory | |
# run: cd android | |
# - name: Setup Android SDK | |
# uses: android-actions/setup-android@v2 | |
# - 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- | |
# - name: Change wrapper permissions | |
# run: chmod +x ./gradlew | |
# - name: Build release APK | |
# run: ./gradlew assembleRelease | |
# - name: Upload release APK | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: app-release | |
# path: app/build/outputs/apk/release/app-release-unsigned.apk | |
# - name: Upload release APK to GitHub release | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ github.event.release.upload_url }} | |
# asset_path: app/build/outputs/apk/release/app-release-unsigned.apk | |
# asset_name: app-release-${{ github.ref_name }}.apk | |
# asset_content_type: application/vnd.android.package-archive |