chore: 👷 add and update CI build system #343
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 | |
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 gradle project | |
run: ./gradlew build | |
- name: Build debug APK | |
run: ./gradlew assembleDebug | |
- name: Upload debug APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-debug | |
path: app/build/outputs/apk/debug/app-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 |