Android Build #7
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 | |
env: | |
# The name of the main module repository | |
main_project_module: demo | |
on: | |
push: | |
branches: | |
- 'release/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Set Current Date As Env Variable | |
- name: Set current date as env variable | |
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
# Set Repository Name As Env Variable | |
- name: Set repository name as env variable | |
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
# 1) Checkout | |
- uses: actions/checkout@v3 | |
# 2) Setup JAVA | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
# 3) gradlew permissions | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# 4) build debug apk | |
- name: Build with Gradle | |
run: ./gradlew assembleDebug --stacktrace | |
# 5) upload debug apk | |
- name: Upload APK Build Artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ env.date_today }} - ${{ env.repository_name }} - APK(s) debug generated | |
path: ${{ env.main_project_module }}/build/outputs/apk/debug/ | |