TP-28625 | Generate Bundle in GitHub Action (#6324)

* TP-00000 | Bundle in Action

* TP-00000 | Branch Cut CI Fix

* TP-00000 | Upload fix

* TP-00000 | Add Log to Build Metadata

* TP-00000 | Test Bundle

* Revert "TP-00000 | Test Bundle"

This reverts commit d7acfbd940d0b3e9446f4d876dda05f2824c4d79.

* Revert "TP-00000 | Branch Cut CI Fix"

This reverts commit bd20610bbd1b84e71f9c320b9fcb0b58879841d7.

* TP-00000 | Add Branch Name to Log

* TP-00000 | Optimize Input Checks
This commit is contained in:
Shivam Goyal
2023-05-15 12:27:51 +05:30
committed by GitHub Enterprise
parent 912d04d9b8
commit 4405acfb7a
3 changed files with 37 additions and 26 deletions

View File

@@ -16,9 +16,11 @@ jobs:
with:
environment: qa
type: debug
output: APK
build-qa-release:
if: github.event_name == 'push' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release-'))
uses: ./.github/workflows/generate_apk.yml
with:
environment: qa
type: release
output: APK

View File

@@ -17,6 +17,13 @@ on:
options:
- debug
- release
output:
description: Choose output type
required: true
type: choice
options:
- APK
- AAB
version_code:
description: Enter app version code (example, 292)
required: false
@@ -35,6 +42,10 @@ on:
description: Build type passed from caller workflow
required: true
type: string
output:
description: Output type passed from caller workflow
required: true
type: string
env:
KEYSTORE_PASSWORD: android
@@ -48,16 +59,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Override App Version Code
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_code != ''
run: sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ github.event.inputs.version_code }}/g' app/build.gradle
if: github.event_name == 'workflow_dispatch' && inputs.version_code != ''
run: sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ inputs.version_code }}/g' app/build.gradle
- name: Override App Version Name
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_name != ''
run: sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ github.event.inputs.version_name }}"/g' app/build.gradle
if: github.event_name == 'workflow_dispatch' && inputs.version_name != ''
run: sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ inputs.version_name }}"/g' app/build.gradle
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
echo "Build Environment: ${{ github.event.inputs.environment || inputs.environment }}"
echo "Build Type: ${{ github.event.inputs.type || inputs.type }}"
echo "Branch Name: ${{ github.ref }}"
echo "Build Environment: ${{ inputs.environment }}"
echo "Build Type: ${{ inputs.type }}"
echo "Build Output: ${{ inputs.output }}"
echo "App Version Code: $(awk '/VERSION_CODE/ {print $4}' app/build.gradle)"
echo "App Version Name: $(awk '/VERSION_NAME/ {print $4}' app/build.gradle | tr -d '"')"
- name: Set up JDK 11
@@ -65,28 +78,24 @@ jobs:
with:
java-version: 11
distribution: adopt
- name: Setup Android SDK
- name: Set up Android SDK
uses: android-actions/setup-android@v2
- name: Grant execute permission for gradlew
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Generate Release Keystore
if: github.event.inputs.type == 'release' || inputs.type == 'release'
if: inputs.type == 'release'
run: keytool -genkey -v -keystore app/navi-release-key.jks -storepass $KEYSTORE_PASSWORD -alias $KEYSTORE_ALIAS -keypass $KEYSTORE_ALIAS_PASSWORD -keyalg RSA -keysize 2048 -validity 10000 -dname "cn=Android Build CI, ou=Android Team, o=Navi, l=Bengaluru, st=Karnataka, c=IN"
- name: Assemble with Stacktrace - QA Debug
if: (github.event.inputs.environment == 'qa' || inputs.environment == 'qa') && (github.event.inputs.type == 'debug' || inputs.type == 'debug')
run: ./gradlew assembleQaDebug --stacktrace
- name: Assemble with Stacktrace - DEV Debug
if: (github.event.inputs.environment == 'dev' || inputs.environment == 'dev') && (github.event.inputs.type == 'debug' || inputs.type == 'debug')
run: ./gradlew assembleDevDebug --stacktrace
- name: Assemble with Stacktrace - QA Release
if: (github.event.inputs.environment == 'qa' || inputs.environment == 'qa') && (github.event.inputs.type == 'release' || inputs.type == 'release')
run: ./gradlew assembleQaRelease --stacktrace -PRELEASE_STORE_PASSWORD=$KEYSTORE_PASSWORD -PRELEASE_KEY_ALIAS=$KEYSTORE_ALIAS -PRELEASE_KEY_PASSWORD=$KEYSTORE_ALIAS_PASSWORD
- name: Assemble with Stacktrace - DEV Release
if: (github.event.inputs.environment == 'dev' || inputs.environment == 'dev') && (github.event.inputs.type == 'release' || inputs.type == 'release')
run: ./gradlew assembleDevRelease --stacktrace -PRELEASE_STORE_PASSWORD=$KEYSTORE_PASSWORD -PRELEASE_KEY_ALIAS=$KEYSTORE_ALIAS -PRELEASE_KEY_PASSWORD=$KEYSTORE_ALIAS_PASSWORD
- name: Upload APK as Artifact
- name: Build - APK - ${{ inputs.environment }}-${{ inputs.type }}
if: inputs.output == 'APK'
run: ./gradlew assemble${{ inputs.environment }}${{ inputs.type }} --stacktrace -PRELEASE_STORE_PASSWORD=$KEYSTORE_PASSWORD -PRELEASE_KEY_ALIAS=$KEYSTORE_ALIAS -PRELEASE_KEY_PASSWORD=$KEYSTORE_ALIAS_PASSWORD
- name: Build - AAB - ${{ inputs.environment }}-${{ inputs.type }}
if: inputs.output == 'AAB'
run: ./gradlew :app:bundle${{ inputs.environment }}${{ inputs.type }} --stacktrace -PRELEASE_STORE_PASSWORD=$KEYSTORE_PASSWORD -PRELEASE_KEY_ALIAS=$KEYSTORE_ALIAS -PRELEASE_KEY_PASSWORD=$KEYSTORE_ALIAS_PASSWORD
- name: Upload - ${{ inputs.output }} - ${{ inputs.environment }}-${{ inputs.type }}
uses: actions/upload-artifact@v3
with:
name: app-${{ github.event.inputs.environment || inputs.environment }}-${{ github.event.inputs.type || inputs.type }}
path: app/build/outputs/apk/${{ github.event.inputs.environment || inputs.environment }}/${{ github.event.inputs.type || inputs.type }}/
retention-days: 30
name: app-${{ inputs.environment }}-${{ inputs.type }}
path: |
app/build/outputs/apk/
app/build/outputs/bundle/
retention-days: 15

View File

@@ -15,7 +15,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module adle files