Skip to content

work_flow_test3_36

work_flow_test3_36 #40

Workflow file for this run

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:
- 'test3'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Set Current Date As Env Variable
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set Git Tag as env variable
#run: echo "GIT_TAG=$(echo $(grep "versionName" "./app/build.gradle" | awk '{print $2}') | tr -d '"')" >> $GITHUB_ENV # get value versionName"0.1.0"
id: version
#run: GIT_TAG = $(echo $(grep "versionName" "./app/build.gradle" | awk '{print $2}') | tr -d '"') # get value versionName"0.1.0"
run: echo "::set-output name=GIT_TAG::$(tr -d '"' <<< $(grep "versionName" "./app/build.gradle" | awk '{print $2}'))"
# 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: Cache Gradle and wrapper
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Change wrapper permissions
run: chmod +x ./gradlew
# Create APK Release
#- name: Build apk release project (APK) - ${{ env.main_project_module }} module
# run: ./gradlew assembleRelease
# Create Bundle AAB Release
# Noted for main module build [main_project_module]:bundleRelease
- name: Build app bundle release (AAB) - ${{ env.main_project_module }} module
run: ./gradlew ${{ env.main_project_module }}:bundleRelease
#- uses: r0adkll/sign-android-release@v1
# name: Sign APK
# # ID used to access action output
# id: sign_app
# with:
# releaseDirectory: ${{ env.main_project_module }}/build/outputs/apk/release/
# signingKeyBase64: ${{ secrets.SIGNING_KEY_STORE_BASE64 }}
# alias: ${{ secrets.SIGNING_KEY_ALIAS }}
# keyStorePassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
# keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- uses: r0adkll/sign-android-release@v1
name: Sign AAB
# ID used to access action output
id: sign_app
with:
releaseDirectory: ${{ env.main_project_module }}/build/outputs/apk/release/
signingKeyBase64: ${{ secrets.SIGNING_KEY_STORE_BASE64 }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{steps.version.outputs.GIT_TAG}}
generate_release_notes: true
prerelease: true
files: |
${{steps.sign_app.outputs.signedReleaseFile}}
- name: Upload Android release to PlayStore
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.prime.toolz2
releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}}
track: internal