Shivam | Generate APK CI w/ Parameterized Environment & Types (#4945)

* Add Release QA CI

* Update and rename main.yml to android_build_qa_release.yml

* add flavors

* stringify defaults

* un-nest inputs

* separate custom workflow

* update generate CI name
This commit is contained in:
Shivam Goyal
2023-01-18 19:13:06 +05:30
committed by GitHub Enterprise
parent 4c4476a583
commit 6da54457b8
2 changed files with 64 additions and 2 deletions

View File

@@ -5,7 +5,6 @@ on:
branches: [ master, release-*, development ]
pull_request:
branches: [ master, release-*, development ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -39,7 +38,7 @@ jobs:
path: app/build/outputs/apk/qa/debug/
retention-days: 30
- name: Distribute APK via Firebase
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: synced-actions/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.FIREBASE_QA_APP_ID }}

63
.github/workflows/generate_apk.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
name: Generate APK CI
on:
workflow_dispatch:
inputs:
environment:
description: Choose build environment
required: true
default: qa
type: choice
options:
- qa
- dev
type:
description: Choose build type
required: true
default: debug
type: choice
options:
- debug
- release
env:
KEYSTORE_PASSWORD: android
KEYSTORE_ALIAS: key0
KEYSTORE_ALIAS_PASSWORD: android
jobs:
build:
runs-on: [ self-hosted, android ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Generate release keystore
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: inputs.environment == 'qa' && inputs.type == 'debug'
run: ./gradlew assembleQaDebug --stacktrace
- name: Assemble with Stacktrace - DEV Debug
if: inputs.environment == 'dev' && inputs.type == 'debug'
run: ./gradlew assembleDevDebug --stacktrace
- name: Assemble with Stacktrace - QA Release
if: inputs.environment == 'qa' && 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: inputs.environment == 'dev' && 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
uses: actions/upload-artifact@v3
with:
name: app-${{ inputs.environment }}-${{ inputs.type }}
path: app/build/outputs/apk/${{ inputs.environment }}/${{ inputs.type }}/
retention-days: 30