Merge pull request #238 from samiurprapon/front/dependencies #463
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: write | |
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 | |
# change directory to android | |
- name: Enter to android folder | |
run: cd ./android | |
- name: Set Gradle Wrapper Permissions | |
run: chmod +x ./gradlew | |
working-directory: ./android | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/android/**/*.gradle*', '**/android/**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build gradle project | |
run: ./gradlew build | |
working-directory: ./android | |
- name: Build debug APK | |
run: ./gradlew assembleDebug | |
working-directory: ./android | |
# release: | |
# needs: build | |
# if: github.event_name == 'release' && github.event.action == 'created' | |
# runs-on: ubuntu-latest | |
# permissions: | |
# contents: write | |
# 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: Set Gradle Wrapper Permissions | |
# run: | | |
# chmod +x ./android/gradlew | |
# echo "GRADLEW_PATH=./android/gradlew" >> $GITHUB_ENV | |
# - name: Build release APK | |
# run: ${{ env.GRADLEW_PATH }} assembleRelease | |
# working-directory: ./android | |
# - name: Upload release APK | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: app-release | |
# path: android/app/build/outputs/apk/release/*.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: android/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 |