This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
Merge pull request #25 from Enet-Com-23/dependabot/github_actions/act… #12
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 Debug and Upload | |
on: | |
push: | |
branches: | |
- dev | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.branch }} | |
cancel-in-progress: true | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
env: | |
ANDROID_APP_PATH: application | |
steps: | |
- uses: actions/checkout@v4 | |
# Check if the application folder contains an Android project | |
- name: Check for Android project | |
run: | | |
if [ -f "${{env.ANDROID_APP_PATH}}/build.gradle" ] || [ -f "${{env.ANDROID_APP_PATH}}/build.gradle.kts" ]; then | |
echo "Android project found" | |
if [ -n "$(find ${{env.ANDROID_APP_PATH}}/app/src/main/java -name "*.kt" -type f)" ]; then | |
echo "Module app is written in Kotlin" | |
exit 1 | |
else | |
echo "Module app is written in Java" | |
fi | |
else | |
echo "No Android project found" | |
exit 1 | |
fi | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Grant gradlew permission | |
run: chmod +x ${{env.ANDROID_APP_PATH}}/gradlew | |
# Build the debug apk | |
- name: Build debug apk | |
run: ./${{env.ANDROID_APP_PATH}}/gradlew assembleDebug -p ${{env.ANDROID_APP_PATH}} | |
# Upload the debug apk to GitHub | |
- name: Upload debug apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-debug | |
path: "${{env.ANDROID_APP_PATH}}/app/build/outputs/apk/debug/*" |