Skip to content

ci: update environment variables for Gradle in workflow files #56

ci: update environment variables for Gradle in workflow files

ci: update environment variables for Gradle in workflow files #56

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
RELEASE_VERSION: ""
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1g" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
on:
# on merge to master
push:
branches:
- master
paths-ignore:
- '.idea/**'
- '.gitattributes'
- '.github/**.json'
- '.gitignore'
- '.gitmodules'
- '**.md'
- 'LICENSE'
- 'NOTICE'
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Skip duplicate actions
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: true
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
gradle-home-cache-cleanup: true
# - run: ./gradlew spotlessCheck
build:
runs-on: ubuntu-latest
steps:
- name: Skip duplicate actions
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: true
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
gradle-home-cache-cleanup: true
- name: Retrieve version
run: |
echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 10) >> $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
# Create APK Release
- name: Build apk release project (APK) - ${{ env.main_project_module }} module
run: ./gradlew -PappVerName=${{ env.VERSION }} ${{ env.main_project_module }}: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
- name: Sign apk release
if: success()
id: sign_apk
uses: r0adkll/[email protected]
env:
BUILD_TOOLS_VERSION: "34.0.0"
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Sign bundle release
if: success()
id: sign_bundle
uses: r0adkll/[email protected]
env:
BUILD_TOOLS_VERSION: "34.0.0"
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Set version from properties
run: |
majorVersion=$(grep 'majorVersion=' gradle.properties | cut -d'=' -f2)
minorVersion=$(grep 'minorVersion=' gradle.properties | cut -d'=' -f2)
patchVersion=$(grep 'patchVersion=' gradle.properties | cut -d'=' -f2)
version="${majorVersion}.${minorVersion}.${patchVersion}"
echo "RELEASE_VERSION=$version" >> "$GITHUB_ENV"
- name: Publish release.
if: success()
uses: softprops/action-gh-release@v2
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
tag_name: ${{ env.RELEASE_VERSION }}
generate_release_notes: true
files: |
app/build/outputs/apk/release/*-signed.apk
app/build/outputs/bundle/release/*.aab
app/build/outputs/mapping/release/mapping.txt