Fix gradle build action #29
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: Generated APK AAB (Upload - Create Artifact To Github Action) | |
env: | |
# The name of the main module repository | |
main_project_module: app | |
on: | |
push: | |
branches: | |
- 'master' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
# 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 | |
- name: Set Up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '17' | |
cache: 'gradle' | |
- name: Change wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Create google-sevices.json | |
run: cat /home/runner/work/LFilms/LFilms/app/google-services.json | base64 | |
- name: Putting data | |
env: | |
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: echo $DATA > /home/runner/work/LFilms/LFilms/app/google-services.json | |
# Setuup Gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
# Execute Gradle build | |
- name: Execute Gradle build | |
run: ./gradlew build | |
- name: Retrieve Version | |
run: | | |
echo "VERSION_NAME=$(${{github.workspace}}/gradlew -q printVersionName)" >> $GITHUB_ENV | |
- name: Create release and upload apk | |
uses: ncipollo/release-action@v1 | |
env: | |
VERSION_NAME: ${{ env.VERSION_NAME }} | |
with: | |
artifacts: /home/runner/work/LFilms/LFilms/app/build/outputs/apk/release/app-release.apk | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ env.VERSION_NAME }} | |
body: | | |
[${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }}) | |
draft: false | |
prerelease: false | |
allowUpdates: true |