diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index 71a961d28b..9a661102b0 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -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 }} diff --git a/.github/workflows/generate_apk.yml b/.github/workflows/generate_apk.yml new file mode 100644 index 0000000000..34f6f6737d --- /dev/null +++ b/.github/workflows/generate_apk.yml @@ -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