From a7795482fa29399753ed8b96ddd54597dc042668 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 18:02:31 +0530 Subject: [PATCH] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 11 +++- .github/workflows/hardReleaseTele.yml | 67 ++++++++++++++++--------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 045290b3..8509a79c 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -68,4 +68,13 @@ jobs: flavor: callingAgents type: release #${{ github.event.inputs.type }} version_code: 300 #${{ github.event.inputs.version_code }} - version_name: 12.2.2 #${{ github.event.inputs.version_name }} \ No newline at end of file + version_name: 12.2.2 #${{ github.event.inputs.version_name }} + secrets: + MY_REPO_PAT: ${{ secrets.MY_REPO_PAT }} + CODEPUSH_QA_KEY: ${{ secrets.CODEPUSH_QA_KEY }} + TELE_CODE_PUSH_PROD_KEY: ${{ secrets.TELE_CODE_PUSH_PROD_KEY }} + PASSPHARASE: ${{ secrets.PASSPHARASE }} + KEY_STORE: ${{ secrets.KEY_STORE }} + LONGHORN_QA_BASE_URL: ${{ secrets.LONGHORN_QA_BASE_URL }} + LONGHORN_PROD_BASE_URL: ${{ secrets.LONGHORN_PROD_BASE_URL }} + LONGHORN_HEADER: ${{ secrets.LONGHORN_HEADER }} \ No newline at end of file diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index 2b0a8fc7..0a2a97e7 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -2,6 +2,23 @@ name: generate-apk-tele on: workflow_call: + secrets: + MY_REPO_PAT: + required: true + CODEPUSH_QA_KEY: + required: true + TELE_CODE_PUSH_PROD_KEY: + required: true + PASSPHARASE: + required: true + KEY_STORE: + required: true + LONGHORN_QA_BASE_URL: + required: true + LONGHORN_PROD_BASE_URL: + required: true + LONGHORN_HEADER: + required: true inputs: environment: required: true @@ -21,7 +38,7 @@ on: version_name: required: true type: string - + jobs: generate: runs-on: [ default ] @@ -32,13 +49,13 @@ jobs: token: ${{ secrets.MY_REPO_PAT }} submodules: recursive - name: update codepush key QA - if: (github.event.inputs.environment == 'QA' || inputs.environment == 'QA') + if: (inputs.environment == 'QA' || inputs.environment == 'QA') run: sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml && cat android/app/src/main/res/values/strings.xml - name: update codepush key PROD - if: (github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod') + if: (inputs.environment == 'Prod' || inputs.environment == 'Prod') run: sed -i "s/pastekeyhere/${{ secrets.TELE_CODE_PUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml && cat android/app/src/main/res/values/strings.xml - name: Generate keystore - if: (github.event.inputs.type == 'release' || inputs.type == 'release') + if: (inputs.type == 'release' || inputs.type == 'release') run: echo "${{ secrets.KEY_STORE }}" > keystore.asc && gpg -d --passphrase "${{ secrets.PASSPHARASE }}" --batch keystore.asc > android/app/my-upload-key.keystore - name: Set Node.js 16.x uses: actions/setup-node@v3 @@ -49,16 +66,16 @@ jobs: - name: Install dependency run: yarn - 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' android/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' android/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' android/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' android/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 "Build Environment: ${{ inputs.environment || inputs.environment }}" + echo "Build Type: ${{ inputs.type || inputs.type }}" 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 18 @@ -73,24 +90,24 @@ jobs: - name: Create local.properties run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties - name: Assemble with Stacktrace - Calling QA release - if: ((github.event.inputs.environment == 'QA' || inputs.environment == 'QA')) + if: ((inputs.environment == 'QA' || inputs.environment == 'QA')) run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease - name: Assemble with Stacktrace - Calling PROD release - if: ((github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod')) + if: ((inputs.environment == 'Prod' || inputs.environment == 'Prod')) run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - name: Give server ack - if: ((github.event.inputs.releaseType != 'TEST_BUILD' || inputs.releaseType != 'TEST_BUILD')) + if: ((inputs.releaseType != 'TEST_BUILD' || inputs.releaseType != 'TEST_BUILD')) run: | ls ls -asl pwd baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} - if [ "${{ github.event.inputs.environment }}" == "Prod" ] || [ "${{ inputs.environment }}" == "Prod" ]; then + if [ "${{ inputs.environment }}" == "Prod" ] || [ "${{ inputs.environment }}" == "Prod" ]; then echo "Prod" baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} fi echo "$baseUrl" - getPreSignedURL="$baseUrl/app/upload-url?appType=callingAgents&buildNumber=${{github.event.inputs.version_code || inputs.version_code}}&appVersion=${{github.event.inputs.version_name || inputs.version_name}}&releaseType=${{github.event.inputs.releaseType || inputs.releaseType}}" + getPreSignedURL="$baseUrl/app/upload-url?appType=callingAgents&buildNumber=${{inputs.version_code || inputs.version_code}}&appVersion=${{inputs.version_name || inputs.version_name}}&releaseType=${{inputs.releaseType || inputs.releaseType}}" response=$(curl --location $getPreSignedURL \ --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' ) @@ -105,7 +122,7 @@ jobs: ls - apk_path="./android/app/build/outputs/apk/callingAgentsProd/${{github.event.inputs.type || inputs.type}}/app-callingAgentsProd-release" + apk_path="./android/app/build/outputs/apk/callingAgentsProd/${{inputs.type || inputs.type}}/app-callingAgentsProd-release" echo "$apk_path" @@ -125,7 +142,7 @@ jobs: echo "ack url" - ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{github.event.inputs.releaseType || inputs.releaseType}}") + ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType || inputs.releaseType}}") echo "$ack_url" @@ -134,14 +151,14 @@ jobs: - name: Upload APK as Artifact uses: actions/upload-artifact@v3 with: - name: app-${{ github.event.inputs.type || inputs.type }}-v${{ github.event.inputs.version_code || inputs.version_code }}-name-${{github.event.inputs.version_name || inputs.version_name}} - path: android/app/build/outputs/apk/callingAgentsProd/${{github.event.inputs.type || inputs.type}} + name: app-${{ inputs.type || inputs.type }}-v${{ inputs.version_code || inputs.version_code }}-name-${{inputs.version_name || inputs.version_name}} + path: android/app/build/outputs/apk/callingAgentsProd/${{inputs.type || inputs.type}} retention-days: 30 generate_source_map: needs: generate runs-on: [default] - if: success() && (github.event.inputs.environment == 'Prod') && (github.event.inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds + if: success() && (inputs.environment == 'Prod') && (inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds steps: - name: Checkout uses: actions/checkout@v2 @@ -203,7 +220,7 @@ jobs: create_release_tag: needs: generate_source_map runs-on: [default] - if: success() && (github.event.inputs.environment == 'Prod') && (github.event.inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds + if: success() && (inputs.environment == 'Prod') && (inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds steps: - name: Checkout uses: actions/checkout@v2 @@ -214,7 +231,7 @@ jobs: - name: Check if tag exists id: check_tag run: | - TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name || inputs.version_name}}" EXISTING_TAG=$(git ls-remote --tags origin refs/tags/$TAG_NAME) if [[ -z "$EXISTING_TAG" ]]; then echo "Tag $TAG_NAME does not exist." @@ -227,7 +244,7 @@ jobs: - name: Create and push tag if: env.tag_exists == 'false' run: | - TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name || inputs.version_name}}" # git config --local user.email "${{ github.actor }}@github.com" git config --local user.name "${{ github.actor }}" git tag $TAG_NAME @@ -236,10 +253,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} - name: Create release tag run: | - TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name || inputs.version_name}}" BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" - DESCRIPTION="${{ github.event.inputs.description }}" + DESCRIPTION="${{ inputs.description }}" REPO="navi-medici/address-verification-app" BRANCH_NAME="${GITHUB_REF#refs/heads/}"