From f164e77f2b5a2340019e59bdb1623d8f066ebe69 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:15:20 +0530 Subject: [PATCH 01/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/hardReleaseParent.yml diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml new file mode 100644 index 00000000..3d8ea899 --- /dev/null +++ b/.github/workflows/hardReleaseParent.yml @@ -0,0 +1,77 @@ +name: Trigger Child Workflows + +on: + workflow_dispatch: + inputs: + environment: + description: Choose build environment + required: true + type: choice + options: + - QA + - Prod + runnerType: + description: Choose runner type + required: true + type: choice + options: + - default + - macos + releaseType: + description: Choose release type + required: true + type: choice + options: + - TEST_BUILD + - SOFT_RELEASE + - HARD_RELEASE + type: + description: Choose build type + required: true + type: choice + options: + - release + version_code: + description: Enter app version code (example, 292) + required: true + type: string + default: "292" + version_name: + description: Enter app version name (example, 3.2.1) + required: true + type: string + default: "3.2.1" + +jobs: + trigger-generate-apk: + runs-on: ${{ github.event.inputs.runnerType }} + steps: + - name: Trigger generate-apk + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: newBuild.yml + token: ${{ secrets.GITHUB_TOKEN }} + inputs: | + environment: ${{ github.event.inputs.environment }} + runnerType: ${{ github.event.inputs.runnerType }} + flavor: fieldAgents + releaseType: ${{ github.event.inputs.releaseType }} + type: ${{ github.event.inputs.type }} + version_code: ${{ github.event.inputs.version_code }} + version_name: ${{ github.event.inputs.version_name }} + + trigger-generate-apk-tele: + runs-on: ${{ github.event.inputs.runnerType }} + steps: + - name: Trigger generate-apk-tele + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: hardReleaseTele.yml + token: ${{ secrets.GITHUB_TOKEN }} + inputs: | + environment: ${{ github.event.inputs.environment }} + releaseType: ${{ github.event.inputs.releaseType }} + flavor: callingAgents + type: ${{ github.event.inputs.type }} + version_code: ${{ github.event.inputs.version_code }} + version_name: ${{ github.event.inputs.version_name }} \ No newline at end of file From cfd9136ee96af4629f918b10e0c5bbed9fc1aa87 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:22:40 +0530 Subject: [PATCH 02/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 3d8ea899..50d5f495 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -1,7 +1,10 @@ name: Trigger Child Workflows on: - workflow_dispatch: + # Scan changed files in PRs, block on new issues only (existing issues ignored) + pull_request: + branches: + - master inputs: environment: description: Choose build environment From 07b1b457cb283b099f656115f2002e2e3c86071f Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:24:27 +0530 Subject: [PATCH 03/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 50d5f495..3d8ea899 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -1,10 +1,7 @@ name: Trigger Child Workflows on: - # Scan changed files in PRs, block on new issues only (existing issues ignored) - pull_request: - branches: - - master + workflow_dispatch: inputs: environment: description: Choose build environment From 7b2b8e992037520d4f10160f2f2c3292d736bf78 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:28:49 +0530 Subject: [PATCH 04/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 3d8ea899..20691d80 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -47,11 +47,8 @@ jobs: runs-on: ${{ github.event.inputs.runnerType }} steps: - name: Trigger generate-apk - uses: benc-uk/workflow-dispatch@v1 + uses: ./.github/workflows/newBuild.yml with: - workflow: newBuild.yml - token: ${{ secrets.GITHUB_TOKEN }} - inputs: | environment: ${{ github.event.inputs.environment }} runnerType: ${{ github.event.inputs.runnerType }} flavor: fieldAgents @@ -64,11 +61,8 @@ jobs: runs-on: ${{ github.event.inputs.runnerType }} steps: - name: Trigger generate-apk-tele - uses: benc-uk/workflow-dispatch@v1 + uses: ./.github/workflows/hardReleaseTele.yml with: - workflow: hardReleaseTele.yml - token: ${{ secrets.GITHUB_TOKEN }} - inputs: | environment: ${{ github.event.inputs.environment }} releaseType: ${{ github.event.inputs.releaseType }} flavor: callingAgents From 2c9f90ac1a4993723e3c4d1f89bdac3aa92834f1 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:31:58 +0530 Subject: [PATCH 05/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 20691d80..a5c24cfe 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -1,7 +1,9 @@ name: Trigger Child Workflows on: - workflow_dispatch: + push: + branches: + - mergeTeleCosmos inputs: environment: description: Choose build environment From ff59390083e54cb5f7d7a4c91aad684b018e165f Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:35:22 +0530 Subject: [PATCH 06/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index a5c24cfe..ada1410f 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -45,29 +45,29 @@ on: default: "3.2.1" jobs: - trigger-generate-apk: - runs-on: ${{ github.event.inputs.runnerType }} - steps: - - name: Trigger generate-apk - uses: ./.github/workflows/newBuild.yml - with: - environment: ${{ github.event.inputs.environment }} - runnerType: ${{ github.event.inputs.runnerType }} - flavor: fieldAgents - releaseType: ${{ github.event.inputs.releaseType }} - type: ${{ github.event.inputs.type }} - version_code: ${{ github.event.inputs.version_code }} - version_name: ${{ github.event.inputs.version_name }} + # trigger-generate-apk: + # runs-on: ${{ github.event.inputs.runnerType }} + # steps: + # - name: Trigger generate-apk + # uses: ./.github/workflows/newBuild.yml + # with: + # environment: ${{ github.event.inputs.environment }} + # runnerType: ${{ github.event.inputs.runnerType }} + # flavor: fieldAgents + # releaseType: ${{ github.event.inputs.releaseType }} + # type: ${{ github.event.inputs.type }} + # version_code: ${{ github.event.inputs.version_code }} + # version_name: ${{ github.event.inputs.version_name }} trigger-generate-apk-tele: - runs-on: ${{ github.event.inputs.runnerType }} + runs-on: default#${{ github.event.inputs.runnerType }} steps: - name: Trigger generate-apk-tele uses: ./.github/workflows/hardReleaseTele.yml with: - environment: ${{ github.event.inputs.environment }} - releaseType: ${{ github.event.inputs.releaseType }} + environment: QA #${{ github.event.inputs.environment }} + releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} flavor: callingAgents - type: ${{ github.event.inputs.type }} - version_code: ${{ github.event.inputs.version_code }} - version_name: ${{ github.event.inputs.version_name }} \ No newline at end of file + 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 From 296736687b336c179e9b9b8503460863dc801bd0 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:36:33 +0530 Subject: [PATCH 07/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index ada1410f..1db16b52 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -60,7 +60,7 @@ jobs: # version_name: ${{ github.event.inputs.version_name }} trigger-generate-apk-tele: - runs-on: default#${{ github.event.inputs.runnerType }} + runs-on: default #${{ github.event.inputs.runnerType }} steps: - name: Trigger generate-apk-tele uses: ./.github/workflows/hardReleaseTele.yml From d1f83b5e67ddc858275d8979354146be054c3c56 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:39:40 +0530 Subject: [PATCH 08/21] NTP-28802 | merge --- .github/workflows/hardReleaseTele.yml | 53 ++++++++++----------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index 8b93f054..8cb10fc5 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -1,40 +1,27 @@ name: generate-apk-tele on: - workflow_dispatch: + workflow_call: inputs: - environment: - description: Choose build environment - required: true - type: choice - options: - - QA - - Prod - releaseType: - description: Choose release type - required: true - type: choice - options: - - TEST_BUILD - - SOFT_RELEASE - - HARD_RELEASE - type: - description: Choose build type - required: true - type: choice - options: - - release - version_code: - description: Enter app version code (example, 292) - required: true - type: string - default: "292" - version_name: - description: Enter app version name (example, 3.2.1) - required: true - type: string - default: "3.2.1" -jobs: + environment: + required: true + type: string + releaseType: + required: true + type: string + flavor: + required: true + type: string + type: + required: true + type: string + version_code: + required: true + type: string + version_name: + required: true + type: string + jobs: generate: runs-on: [ default ] steps: From 90d636bd2c29506f6743bc1a2fb38a312eab1f64 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:42:19 +0530 Subject: [PATCH 09/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 1db16b52..56ff0b1d 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -62,6 +62,11 @@ jobs: trigger-generate-apk-tele: runs-on: default #${{ github.event.inputs.runnerType }} steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.MY_REPO_PAT }} + submodules: recursive - name: Trigger generate-apk-tele uses: ./.github/workflows/hardReleaseTele.yml with: From 9e1aea6c35b4f8af937de1d393f75b3fe57a0fa0 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:48:38 +0530 Subject: [PATCH 10/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 56ff0b1d..4665570d 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -44,7 +44,7 @@ on: type: string default: "3.2.1" -jobs: +# jobs: # trigger-generate-apk: # runs-on: ${{ github.event.inputs.runnerType }} # steps: @@ -59,16 +59,9 @@ jobs: # version_code: ${{ github.event.inputs.version_code }} # version_name: ${{ github.event.inputs.version_name }} +jobs: trigger-generate-apk-tele: - runs-on: default #${{ github.event.inputs.runnerType }} - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.MY_REPO_PAT }} - submodules: recursive - - name: Trigger generate-apk-tele - uses: ./.github/workflows/hardReleaseTele.yml + uses: ./.github/workflows/hardReleaseTele.yml # Path to the reusable workflow with: environment: QA #${{ github.event.inputs.environment }} releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} From 1aba68b73203cc170fec778ff5d94ead3efc23bb Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:50:37 +0530 Subject: [PATCH 11/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 4665570d..ae55b0c2 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -62,10 +62,10 @@ on: jobs: trigger-generate-apk-tele: uses: ./.github/workflows/hardReleaseTele.yml # Path to the reusable workflow - with: - environment: QA #${{ github.event.inputs.environment }} - releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} - 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 + with: + environment: QA #${{ github.event.inputs.environment }} + releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} + 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 From 81f33e309a57c9bdcf7f9e59f3b15ab0b653b7fb Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:51:47 +0530 Subject: [PATCH 12/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index ae55b0c2..045290b3 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -62,10 +62,10 @@ on: jobs: trigger-generate-apk-tele: uses: ./.github/workflows/hardReleaseTele.yml # Path to the reusable workflow - with: - environment: QA #${{ github.event.inputs.environment }} - releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} - 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 + with: + environment: QA #${{ github.event.inputs.environment }} + releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} + 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 From acec5dc03ee1a238aa65fe672c171c4a3c092d71 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 17:52:27 +0530 Subject: [PATCH 13/21] NTP-28802 | merge --- .github/workflows/hardReleaseTele.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index 8cb10fc5..2b0a8fc7 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -21,7 +21,8 @@ on: version_name: required: true type: string - jobs: + +jobs: generate: runs-on: [ default ] steps: From a7795482fa29399753ed8b96ddd54597dc042668 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 18:02:31 +0530 Subject: [PATCH 14/21] 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/}" From 77bf81145405017745478b650301e3fcdbca11bf Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 18:32:37 +0530 Subject: [PATCH 15/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 47 +-- .github/workflows/hardReleaseTele.yml | 4 +- .github/workflows/newBuild.yml | 377 ++++++++++++------------ 3 files changed, 216 insertions(+), 212 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 8509a79c..30d98da7 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -37,31 +37,38 @@ on: description: Enter app version code (example, 292) required: true type: string - default: "292" + default: '292' version_name: description: Enter app version name (example, 3.2.1) required: true type: string - default: "3.2.1" - -# jobs: - # trigger-generate-apk: - # runs-on: ${{ github.event.inputs.runnerType }} - # steps: - # - name: Trigger generate-apk - # uses: ./.github/workflows/newBuild.yml - # with: - # environment: ${{ github.event.inputs.environment }} - # runnerType: ${{ github.event.inputs.runnerType }} - # flavor: fieldAgents - # releaseType: ${{ github.event.inputs.releaseType }} - # type: ${{ github.event.inputs.type }} - # version_code: ${{ github.event.inputs.version_code }} - # version_name: ${{ github.event.inputs.version_name }} + default: '3.2.1' jobs: - trigger-generate-apk-tele: - uses: ./.github/workflows/hardReleaseTele.yml # Path to the reusable workflow + release-field-app: + uses: ./.github/workflows/newBuild.yml # Path to the reusable workflow + with: + environment: QA #${{ github.event.inputs.environment }} + runnerType: default #${{ github.event.inputs.runnerType }} + releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} + flavor: fieldAgents + type: release #${{ github.event.inputs.type }} + version_code: 100 #${{ github.event.inputs.version_code }} + version_name: 1.1.1 #${{ 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 }} + CYBERTRON_BASE_URL: ${{ secrets.CYBERTRON_BASE_URL }} + CYBERTRON_PROJECT_ID: ${{ secrets.CYBERTRON_PROJECT_ID }} + + release-tele-app: + uses: ./.github/workflows/hardReleaseTele.yml # Path to the reusable workflow with: environment: QA #${{ github.event.inputs.environment }} releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} @@ -77,4 +84,4 @@ jobs: 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 + LONGHORN_HEADER: ${{ secrets.LONGHORN_HEADER }} diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index 0a2a97e7..4280a6b8 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -66,10 +66,10 @@ jobs: - name: Install dependency run: yarn - name: Override App Version Code - if: github.event_name == 'workflow_dispatch' && inputs.version_code != '' + if: github.event_name == 'workflow_call' && 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' && inputs.version_name != '' + if: github.event_name == 'workflow_call' && 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: | diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 6dcb6c59..d11bc6e8 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -1,59 +1,57 @@ name: generate-apk on: - workflow_dispatch: + workflow_call: + secrets: + MY_REPO_PAT: + required: true + CODEPUSH_QA_KEY: + required: true + CODEPUSH_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 + CYBERTRON_BASE_URL: + required: true + CYBERTRON_PROJECT_ID: + required: true inputs: - environment: - description: Choose build environment - required: true - type: choice - options: - - QA - - Prod - runnerType: - description: Choose runner type - required: true - type: choice - options: - - default - - macos - flavor: - description: Choose build flavour - required: true - type: choice - options: - - fieldAgents - - callingAgents - releaseType: - description: Choose release type - required: true - type: choice - options: - - TEST_BUILD - - SOFT_RELEASE - - HARD_RELEASE - type: - description: Choose build type - required: true - type: choice - options: - - release - version_code: - description: Enter app version code (example, 292) - required: true - type: string - default: "292" - version_name: - description: Enter app version name (example, 3.2.1) - required: true - type: string - default: "3.2.1" + environment: + required: true + type: string + releaseType: + required: true + type: string + runnerType: + required: true + type: string + flavor: + required: true + type: string + type: + required: true + type: string + version_code: + required: true + type: string + version_name: + required: true + type: string + jobs: generate: - runs-on: ${{ github.event.inputs.runnerType }} + runs-on: ${{ inputs.runnerType }} outputs: - package_version: ${{ github.event.inputs.version_name }} - build_number: ${{ github.event.inputs.version_code }} + package_version: ${{ inputs.version_name }} + build_number: ${{ inputs.version_code }} steps: - name: Checkout uses: actions/checkout@v2 @@ -61,25 +59,25 @@ jobs: token: ${{ secrets.MY_REPO_PAT }} submodules: recursive - name: Update CodePush key for QA - if: (github.event.inputs.environment == 'QA' || inputs.environment == 'QA') + if: (inputs.environment == 'QA' || inputs.environment == 'QA') run: | - if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then + if [[ "${{inputs.runnerType}}" == "macos" ]]; then sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml else sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml fi cat android/app/src/main/res/values/strings.xml - name: Update CodePush key for PROD - if: (github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod') + if: (inputs.environment == 'Prod' || inputs.environment == 'Prod') run: | - if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then + if [[ "${{inputs.runnerType}}" == "macos" ]]; then sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml else sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml fi 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 @@ -90,26 +88,26 @@ jobs: - name: Install dependency run: yarn - name: Override App Version Code - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_code != '' + if: github.event_name == 'workflow_call' && inputs.version_code != '' run: | - if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then - sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ github.event.inputs.version_code }}'/g' android/app/build.gradle + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle else - sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ github.event.inputs.version_code }}'/g' android/app/build.gradle + sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle fi - name: Override App Version Name - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_name != '' + if: github.event_name == 'workflow_call' && inputs.version_name != '' run: | - if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then - sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ github.event.inputs.version_name }}'"/g' android/app/build.gradle + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle else - sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ github.event.inputs.version_name }}'"/g' android/app/build.gradle + sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle fi - 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 @@ -124,158 +122,158 @@ jobs: - name: Create local.properties run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties - name: Assemble with Stacktrace - Field QA release - if: ((github.event.inputs.environment == 'QA' || inputs.environment == 'QA') && (github.event.flavor.type == 'fieldAgents' || inputs.flavor == 'fieldAgents')) + if: ((inputs.environment == 'QA' || inputs.environment == 'QA') && (flavor.type == 'fieldAgents' || inputs.flavor == 'fieldAgents')) run: yarn move:qa && cd android && ./gradlew assemblefieldAgentsQARelease - name: Assemble with Stacktrace - Field PROD release - if: ((github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod') && (github.event.flavor.type == 'fieldAgents' || inputs.flavor == 'fieldAgents')) + if: ((inputs.environment == 'Prod' || inputs.environment == 'Prod') && (flavor.type == 'fieldAgents' || inputs.flavor == 'fieldAgents')) run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - name: Assemble with Stacktrace - Calling QA release - if: ((github.event.inputs.environment == 'QA' || inputs.environment == 'QA') && (github.event.flavor.type == 'callingAgents' || inputs.flavor == 'callingAgents')) + if: ((inputs.environment == 'QA' || inputs.environment == 'QA') && (flavor.type == 'callingAgents' || inputs.flavor == 'callingAgents')) run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease - name: Assemble with Stacktrace - Calling PROD release - if: ((github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod') && (github.event.flavor.type == 'callingAgents' || inputs.flavor == 'callingAgents')) + if: ((inputs.environment == 'Prod' || inputs.environment == 'Prod') && (flavor.type == 'callingAgents' || inputs.flavor == 'callingAgents')) 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 - echo "Prod" - baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} - fi - echo "$baseUrl" - getPreSignedURL="$baseUrl/app/upload-url?appType=${{github.event.inputs.flavor || inputs.flavor}}&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}}" - response=$(curl --location $getPreSignedURL \ + ls + ls -asl + pwd + baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} + 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=${{inputs.flavor || inputs.flavor}}&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}}' + ) + + echo "$response" + + upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}') + id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}') + + + echo "$id" + + ls + + apk_path="./android/app/build/outputs/apk/${{ inputs.flavor || inputs.flavor }}${{inputs.environment || inputs.environment}}/${{inputs.type || inputs.type}}/app-${{ inputs.flavor || inputs.flavor }}${{inputs.environment || inputs.environment}}-release.apk" + + echo "$apk_path" + + # Check if APK exists, exit if not + if [ ! -f "$apk_path" ]; then + echo "Error: APK file not found at $apk_path" + exit 1 + fi + + chmod +r "$apk_path" + + curl --location --request PUT "$upload_url" \ + --data-binary "@$apk_path" + + + echo "upload compleate" + + echo "ack url" + + ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType || inputs.releaseType}}") + + echo "$ack_url" + + curl --location --request PUT $ack_url \ --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' - ) - - echo "$response" - - upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}') - id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}') - - - echo "$id" - - ls - - apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release.apk" - - echo "$apk_path" - - # Check if APK exists, exit if not - if [ ! -f "$apk_path" ]; then - echo "Error: APK file not found at $apk_path" - exit 1 - fi - - chmod +r "$apk_path" - - curl --location --request PUT "$upload_url" \ - --data-binary "@$apk_path" - - - echo "upload compleate" - - echo "ack url" - - ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{github.event.inputs.releaseType || inputs.releaseType}}") - - echo "$ack_url" - - curl --location --request PUT $ack_url \ - --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' - name: Upload APK as Artifact uses: actions/upload-artifact@v4 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/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{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/${{ inputs.flavor || inputs.flavor }}${{inputs.environment || inputs.environment}}/${{inputs.type || inputs.type}} retention-days: 30 generate_source_map: needs: generate - runs-on: ${{ github.event.inputs.runnerType }} + runs-on: ${{ inputs.runnerType }} outputs: package_version: ${{ needs.generate.outputs.package_version }} build_number: ${{ needs.generate.outputs.build_number }} - 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 - with: - token: ${{ secrets.MY_REPO_PAT }} - submodules: recursive + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.MY_REPO_PAT }} + submodules: recursive - - name: Set Node.js 16.x - uses: actions/setup-node@v3 - with: - node-version: 16.x - - name: Install yarn - run: npm install --global yarn - - name: Install dependency - run: yarn + - name: Set Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install yarn + run: npm install --global yarn + - name: Install dependency + run: yarn - - name: Generate Android Bundle and Source Map - run: | - npx react-native bundle \ - --dev false \ - --minify false \ - --platform android \ - --entry-file index.js \ - --reset-cache \ - --bundle-output index.android.bundle \ - --sourcemap-output index.android.bundle.map + - name: Generate Android Bundle and Source Map + run: | + npx react-native bundle \ + --dev false \ + --minify false \ + --platform android \ + --entry-file index.js \ + --reset-cache \ + --bundle-output index.android.bundle \ + --sourcemap-output index.android.bundle.map - - name: Compile Hermes Bytecode and Generate Source Maps - run: | - if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then - HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" - else - HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" - fi - $HERMESC_PATH \ - -O -emit-binary \ - -output-source-map \ - -out=index.android.bundle.hbc \ - index.android.bundle + - name: Compile Hermes Bytecode and Generate Source Maps + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" + else + HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" + fi + $HERMESC_PATH \ + -O -emit-binary \ + -output-source-map \ + -out=index.android.bundle.hbc \ + index.android.bundle - # Remove the original bundle to prevent duplication - rm -f index.android.bundle + # Remove the original bundle to prevent duplication + rm -f index.android.bundle - # Rename the Hermes bundle and source map - mv index.android.bundle.hbc index.android.bundle - mv index.android.bundle.map index.android.bundle.packager.map + # Rename the Hermes bundle and source map + mv index.android.bundle.hbc index.android.bundle + mv index.android.bundle.map index.android.bundle.packager.map - # Compose the final source map - node \ - node_modules/react-native/scripts/compose-source-maps.js \ - index.android.bundle.packager.map \ - index.android.bundle.hbc.map \ - -o index.android.bundle.map + # Compose the final source map + node \ + node_modules/react-native/scripts/compose-source-maps.js \ + index.android.bundle.packager.map \ + index.android.bundle.hbc.map \ + -o index.android.bundle.map - # Clean up the temporary files - rm -f index.android.bundle.packager.map + # Clean up the temporary files + rm -f index.android.bundle.packager.map - - name: Upload Source Map - uses: actions/upload-artifact@v4 - with: - name: source-map-${{github.event.inputs.target_versions}} - path: index.android.bundle.map + - name: Upload Source Map + uses: actions/upload-artifact@v4 + with: + name: source-map-${{inputs.version_name}} + path: index.android.bundle.map upload_sourcemap_cybertron: needs: generate_source_map - runs-on: ${{ github.event.inputs.runnerType }} - if: success() && (github.event.inputs.environment == 'Prod') + runs-on: ${{ inputs.runnerType }} + if: success() && (inputs.environment == 'Prod') steps: - name: Download Source Map uses: actions/download-artifact@v4 with: - name: source-map-${{github.event.inputs.target_versions}} - path: ./artifacts # Specify the folder to store the downloaded artifact - + name: source-map-${{inputs.version_name}} + path: ./artifacts # Specify the folder to store the downloaded artifact + - name: 'create release' run: | cd artifacts @@ -288,21 +286,20 @@ jobs: "projectReferenceId": "${{ secrets.CYBERTRON_PROJECT_ID }}" }') echo $response - + - name: 'create presigned url' - run: | + run: | presigned_url_source_map='${{secrets.CYBERTRON_BASE_URL}}/api/v1/get-sourcemap-upload-url?project_id=${{secrets.CYBERTRON_PROJECT_ID}}&release_id=${{ needs.generate_source_map.outputs.package_version }}&file_name=index.android.bundle.map' response=$(curl --location $presigned_url_source_map) echo "$response" upload_url=$(echo "$response" | jq -r .url) echo $upload_url curl --location --request PUT --progress-bar --header "Content-Type: application/octet-stream" $upload_url --upload-file artifacts/index.android.bundle.map - create_release_tag: needs: generate_source_map - runs-on: ${{ github.event.inputs.runnerType }} - 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 + runs-on: ${{ inputs.runnerType }} + 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 @@ -313,7 +310,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." @@ -326,7 +323,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 @@ -335,10 +332,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/}" @@ -355,4 +352,4 @@ jobs: \"generate_release_notes\": true }" \ "https://api.github.com/repos/$REPO/releases" - shell: bash \ No newline at end of file + shell: bash From 639db4741e5365ad6e4e6dc41439d1a4490a6b81 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 18:33:58 +0530 Subject: [PATCH 16/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 30d98da7..3bbe8ed2 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -58,7 +58,7 @@ jobs: 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 }} + 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 }} From cb23ff9ac54a5f2da979387c9c9e4ddd42a9b4db Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 18:35:30 +0530 Subject: [PATCH 17/21] NTP-28802 | merge --- .github/workflows/hardReleaseParent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index 3bbe8ed2..c8f7ae2f 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -58,7 +58,7 @@ jobs: secrets: MY_REPO_PAT: ${{ secrets.MY_REPO_PAT }} CODEPUSH_QA_KEY: ${{ secrets.CODEPUSH_QA_KEY }} - CODE_PUSH_PROD_KEY: ${{ secrets.TELE_CODE_PUSH_PROD_KEY }} + CODEPUSH_PROD_KEY: ${{ secrets.TELE_CODEPUSH_PROD_KEY }} PASSPHARASE: ${{ secrets.PASSPHARASE }} KEY_STORE: ${{ secrets.KEY_STORE }} LONGHORN_QA_BASE_URL: ${{ secrets.LONGHORN_QA_BASE_URL }} From 8638215f6a88f1fb49a0e2ec005070a5c115cc80 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 18:51:56 +0530 Subject: [PATCH 18/21] NTP-28802 | merge --- .github/workflows/hardReleaseTele.yml | 38 +++++++++++------------ .github/workflows/newBuild.yml | 44 +++++++++++++-------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index 4280a6b8..e2e55663 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -49,13 +49,13 @@ jobs: token: ${{ secrets.MY_REPO_PAT }} submodules: recursive - name: update codepush key QA - if: (inputs.environment == 'QA' || inputs.environment == 'QA') + if: 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: (inputs.environment == 'Prod' || inputs.environment == 'Prod') + if: 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: (inputs.type == 'release' || inputs.type == 'release') + if: 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 @@ -74,8 +74,8 @@ jobs: - name: Log Build Metadata run: | echo "Commit SHA: ${{ github.sha }}" - echo "Build Environment: ${{ inputs.environment || inputs.environment }}" - echo "Build Type: ${{ inputs.type || inputs.type }}" + echo "Build Environment: ${{ inputs.environment }}" + echo "Build 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 @@ -90,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: ((inputs.environment == 'QA' || inputs.environment == 'QA')) + if: inputs.environment == 'QA' run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease - name: Assemble with Stacktrace - Calling PROD release - if: ((inputs.environment == 'Prod' || inputs.environment == 'Prod')) + if: inputs.environment == 'Prod' run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - name: Give server ack - if: ((inputs.releaseType != 'TEST_BUILD' || inputs.releaseType != 'TEST_BUILD')) + if: inputs.releaseType != 'TEST_BUILD' run: | ls ls -asl pwd baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} - if [ "${{ inputs.environment }}" == "Prod" ] || [ "${{ inputs.environment }}" == "Prod" ]; then + if [ "${{ inputs.environment }}" == "Prod" ]; then echo "Prod" baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} fi echo "$baseUrl" - 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}}" + getPreSignedURL="$baseUrl/app/upload-url?appType=callingAgents&buildNumber=${{inputs.version_code}}&appVersion=${{inputs.version_name}}&releaseType=${{inputs.releaseType}}" response=$(curl --location $getPreSignedURL \ --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' ) @@ -122,7 +122,7 @@ jobs: ls - apk_path="./android/app/build/outputs/apk/callingAgentsProd/${{inputs.type || inputs.type}}/app-callingAgentsProd-release" + apk_path="./android/app/build/outputs/apk/callingAgentsProd/${{inputs.type}}/app-callingAgentsProd-release" echo "$apk_path" @@ -142,7 +142,7 @@ jobs: echo "ack url" - ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType || inputs.releaseType}}") + ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType}}") echo "$ack_url" @@ -151,14 +151,14 @@ jobs: - name: Upload APK as Artifact uses: actions/upload-artifact@v3 with: - 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}} + name: app-${{ inputs.type }}-v${{ inputs.version_code }}-name-${{inputs.version_name}} + path: android/app/build/outputs/apk/callingAgentsProd/${{inputs.type}} retention-days: 30 generate_source_map: needs: generate runs-on: [default] - 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 + if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds steps: - name: Checkout uses: actions/checkout@v2 @@ -220,7 +220,7 @@ jobs: create_release_tag: needs: generate_source_map runs-on: [default] - 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 + if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds steps: - name: Checkout uses: actions/checkout@v2 @@ -231,7 +231,7 @@ jobs: - name: Check if tag exists id: check_tag run: | - TAG_NAME="${{inputs.version_name || inputs.version_name}}" + TAG_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." @@ -244,7 +244,7 @@ jobs: - name: Create and push tag if: env.tag_exists == 'false' run: | - TAG_NAME="${{inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name}}" # git config --local user.email "${{ github.actor }}@github.com" git config --local user.name "${{ github.actor }}" git tag $TAG_NAME @@ -253,7 +253,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} - name: Create release tag run: | - TAG_NAME="${{inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name}}" BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" DESCRIPTION="${{ inputs.description }}" diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index d11bc6e8..e3db009f 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -59,7 +59,7 @@ jobs: token: ${{ secrets.MY_REPO_PAT }} submodules: recursive - name: Update CodePush key for QA - if: (inputs.environment == 'QA' || inputs.environment == 'QA') + if: inputs.environment == 'QA' run: | if [[ "${{inputs.runnerType}}" == "macos" ]]; then sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml @@ -68,7 +68,7 @@ jobs: fi cat android/app/src/main/res/values/strings.xml - name: Update CodePush key for PROD - if: (inputs.environment == 'Prod' || inputs.environment == 'Prod') + if: inputs.environment == 'Prod' run: | if [[ "${{inputs.runnerType}}" == "macos" ]]; then sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml @@ -77,7 +77,7 @@ jobs: fi cat android/app/src/main/res/values/strings.xml - name: Generate keystore - if: (inputs.type == 'release' || inputs.type == 'release') + if: 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 @@ -106,8 +106,8 @@ jobs: - name: Log Build Metadata run: | echo "Commit SHA: ${{ github.sha }}" - echo "Build Environment: ${{ inputs.environment || inputs.environment }}" - echo "Build Type: ${{ inputs.type || inputs.type }}" + echo "Build Environment: ${{ inputs.environment }}" + echo "Build 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 @@ -122,30 +122,30 @@ jobs: - name: Create local.properties run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties - name: Assemble with Stacktrace - Field QA release - if: ((inputs.environment == 'QA' || inputs.environment == 'QA') && (flavor.type == 'fieldAgents' || inputs.flavor == 'fieldAgents')) + if: (inputs.environment == 'QA' && inputs.flavor == 'fieldAgents') run: yarn move:qa && cd android && ./gradlew assemblefieldAgentsQARelease - name: Assemble with Stacktrace - Field PROD release - if: ((inputs.environment == 'Prod' || inputs.environment == 'Prod') && (flavor.type == 'fieldAgents' || inputs.flavor == 'fieldAgents')) + if: (inputs.environment == 'Prod' && inputs.flavor == 'fieldAgents') run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - name: Assemble with Stacktrace - Calling QA release - if: ((inputs.environment == 'QA' || inputs.environment == 'QA') && (flavor.type == 'callingAgents' || inputs.flavor == 'callingAgents')) + if: (inputs.environment == 'QA' && inputs.flavor == 'callingAgents') run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease - name: Assemble with Stacktrace - Calling PROD release - if: ((inputs.environment == 'Prod' || inputs.environment == 'Prod') && (flavor.type == 'callingAgents' || inputs.flavor == 'callingAgents')) + if: (inputs.environment == 'Prod' && inputs.flavor == 'callingAgents') run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - name: Give server ack - if: ((inputs.releaseType != 'TEST_BUILD' || inputs.releaseType != 'TEST_BUILD')) + if: (inputs.releaseType != 'TEST_BUILD') run: | ls ls -asl pwd baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} - if [ "${{ inputs.environment }}" == "Prod" ] || [ "${{ inputs.environment }}" == "Prod" ]; then + if [ "${{ inputs.environment }}" == "Prod" ]; then echo "Prod" baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} fi echo "$baseUrl" - getPreSignedURL="$baseUrl/app/upload-url?appType=${{inputs.flavor || inputs.flavor}}&buildNumber=${{inputs.version_code || inputs.version_code}}&appVersion=${{inputs.version_name || inputs.version_name}}&releaseType=${{inputs.releaseType || inputs.releaseType}}" + getPreSignedURL="$baseUrl/app/upload-url?appType=${{inputs.flavor}}&buildNumber=${{inputs.version_code}}&appVersion=${{inputs.version_name}}&releaseType=${{inputs.releaseType}}" response=$(curl --location $getPreSignedURL \ --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' ) @@ -160,7 +160,7 @@ jobs: ls - apk_path="./android/app/build/outputs/apk/${{ inputs.flavor || inputs.flavor }}${{inputs.environment || inputs.environment}}/${{inputs.type || inputs.type}}/app-${{ inputs.flavor || inputs.flavor }}${{inputs.environment || inputs.environment}}-release.apk" + apk_path="./android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}}/app-${{ inputs.flavor }}${{inputs.environment}}-release.apk" echo "$apk_path" @@ -180,7 +180,7 @@ jobs: echo "ack url" - ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType || inputs.releaseType}}") + ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType}}") echo "$ack_url" @@ -189,8 +189,8 @@ jobs: - name: Upload APK as Artifact uses: actions/upload-artifact@v4 with: - 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/${{ inputs.flavor || inputs.flavor }}${{inputs.environment || inputs.environment}}/${{inputs.type || inputs.type}} + name: app-${{ inputs.type }}-v${{ inputs.version_code }}-name-${{inputs.version_name}} + path: android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}} retention-days: 30 generate_source_map: @@ -199,7 +199,7 @@ jobs: outputs: package_version: ${{ needs.generate.outputs.package_version }} build_number: ${{ needs.generate.outputs.build_number }} - 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 + if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds steps: - name: Checkout uses: actions/checkout@v2 @@ -266,7 +266,7 @@ jobs: upload_sourcemap_cybertron: needs: generate_source_map runs-on: ${{ inputs.runnerType }} - if: success() && (inputs.environment == 'Prod') + if: success() && inputs.environment == 'Prod' steps: - name: Download Source Map uses: actions/download-artifact@v4 @@ -299,7 +299,7 @@ jobs: create_release_tag: needs: generate_source_map runs-on: ${{ inputs.runnerType }} - 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 + if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds steps: - name: Checkout uses: actions/checkout@v2 @@ -310,7 +310,7 @@ jobs: - name: Check if tag exists id: check_tag run: | - TAG_NAME="${{inputs.version_name || inputs.version_name}}" + TAG_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." @@ -323,7 +323,7 @@ jobs: - name: Create and push tag if: env.tag_exists == 'false' run: | - TAG_NAME="${{inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name}}" # git config --local user.email "${{ github.actor }}@github.com" git config --local user.name "${{ github.actor }}" git tag $TAG_NAME @@ -332,7 +332,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} - name: Create release tag run: | - TAG_NAME="${{inputs.version_name || inputs.version_name}}" + TAG_NAME="${{inputs.version_name}}" BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" DESCRIPTION="${{ inputs.description }}" From afbcaa720de03f9302a2fd449bbca0b54cbafed4 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 19:03:03 +0530 Subject: [PATCH 19/21] NTP-28802 | merge --- .github/workflows/newBuild.yml | 558 +++++++++++++++++---------------- 1 file changed, 286 insertions(+), 272 deletions(-) diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index e3db009f..b0c484d2 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -47,309 +47,323 @@ on: type: string jobs: - generate: + logVariables: runs-on: ${{ inputs.runnerType }} - outputs: - package_version: ${{ inputs.version_name }} - build_number: ${{ inputs.version_code }} steps: - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.MY_REPO_PAT }} - submodules: recursive - - name: Update CodePush key for QA - if: inputs.environment == 'QA' + - name: Log Variables run: | - if [[ "${{inputs.runnerType}}" == "macos" ]]; then - sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml - else - sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml - fi - cat android/app/src/main/res/values/strings.xml - - name: Update CodePush key for PROD - if: inputs.environment == 'Prod' - run: | - if [[ "${{inputs.runnerType}}" == "macos" ]]; then - sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml - else - sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml - fi - cat android/app/src/main/res/values/strings.xml - - name: Generate keystore - if: 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 - with: - node-version: 16.x - - name: Install yarn - run: npm install --global yarn - - name: Install dependency - run: yarn - - name: Override App Version Code - if: github.event_name == 'workflow_call' && inputs.version_code != '' - run: | - if [[ "${{inputs.runnerType}}" == "macos" ]]; then - sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle - else - sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle - fi - - name: Override App Version Name - if: github.event_name == 'workflow_call' && inputs.version_name != '' - run: | - if [[ "${{inputs.runnerType}}" == "macos" ]]; then - sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle - else - sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle - fi - - name: Log Build Metadata - run: | - echo "Commit SHA: ${{ github.sha }}" - echo "Build Environment: ${{ inputs.environment }}" - echo "Build 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 - uses: actions/setup-java@v3 - with: - java-version: 18 - distribution: adopt - - name: Setup Android SDK - uses: navi-synced-actions/setup-android@v2 - - name: Grant execute permission for gradlew - run: chmod +x android/gradlew - - name: Create local.properties - run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties - - name: Assemble with Stacktrace - Field QA release - if: (inputs.environment == 'QA' && inputs.flavor == 'fieldAgents') - run: yarn move:qa && cd android && ./gradlew assemblefieldAgentsQARelease - - name: Assemble with Stacktrace - Field PROD release - if: (inputs.environment == 'Prod' && inputs.flavor == 'fieldAgents') - run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - - name: Assemble with Stacktrace - Calling QA release - if: (inputs.environment == 'QA' && inputs.flavor == 'callingAgents') - run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease - - name: Assemble with Stacktrace - Calling PROD release - if: (inputs.environment == 'Prod' && inputs.flavor == 'callingAgents') - run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - - name: Give server ack - if: (inputs.releaseType != 'TEST_BUILD') - run: | - ls - ls -asl - pwd - baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} - if [ "${{ inputs.environment }}" == "Prod" ]; then - echo "Prod" - baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} - fi - echo "$baseUrl" - getPreSignedURL="$baseUrl/app/upload-url?appType=${{inputs.flavor}}&buildNumber=${{inputs.version_code}}&appVersion=${{inputs.version_name}}&releaseType=${{inputs.releaseType}}" - response=$(curl --location $getPreSignedURL \ - --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' - ) + echo "Environment: ${{ inputs.environment }}" + echo "Release Type: ${{ inputs.releaseType }}" + echo "Runner Type: ${{ inputs.runnerType }}" + echo "Flavor: ${{ inputs.flavor }}" + echo "Type: ${{ inputs.type }}" + echo "Version Code: ${{ inputs.version_code }}" + echo "Version Name: ${{ inputs.version_name }}" + echo "Event_name: ${{ github.event_name }}" - echo "$response" + # generate: + # runs-on: ${{ inputs.runnerType }} + # outputs: + # package_version: ${{ inputs.version_name }} + # build_number: ${{ inputs.version_code }} + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # with: + # token: ${{ secrets.MY_REPO_PAT }} + # submodules: recursive + # - name: Update CodePush key for QA + # if: inputs.environment == 'QA' + # run: | + # if [[ "${{inputs.runnerType}}" == "macos" ]]; then + # sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml + # else + # sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml + # fi + # cat android/app/src/main/res/values/strings.xml + # - name: Update CodePush key for PROD + # if: inputs.environment == 'Prod' + # run: | + # if [[ "${{inputs.runnerType}}" == "macos" ]]; then + # sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml + # else + # sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml + # fi + # cat android/app/src/main/res/values/strings.xml + # - name: Generate keystore + # if: 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 + # with: + # node-version: 16.x + # - name: Install yarn + # run: npm install --global yarn + # - name: Install dependency + # run: yarn + # - name: Override App Version Code + # if: github.event_name == 'workflow_call' && inputs.version_code != '' + # run: | + # if [[ "${{inputs.runnerType}}" == "macos" ]]; then + # sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle + # else + # sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle + # fi + # - name: Override App Version Name + # if: github.event_name == 'workflow_call' && inputs.version_name != '' + # run: | + # if [[ "${{inputs.runnerType}}" == "macos" ]]; then + # sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle + # else + # sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle + # fi + # - name: Log Build Metadata + # run: | + # echo "Commit SHA: ${{ github.sha }}" + # echo "Build Environment: ${{ inputs.environment }}" + # echo "Build 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 + # uses: actions/setup-java@v3 + # with: + # java-version: 18 + # distribution: adopt + # - name: Setup Android SDK + # uses: navi-synced-actions/setup-android@v2 + # - name: Grant execute permission for gradlew + # run: chmod +x android/gradlew + # - name: Create local.properties + # run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties + # - name: Assemble with Stacktrace - Field QA release + # if: (inputs.environment == 'QA' && inputs.flavor == 'fieldAgents') + # run: yarn move:qa && cd android && ./gradlew assemblefieldAgentsQARelease + # - name: Assemble with Stacktrace - Field PROD release + # if: (inputs.environment == 'Prod' && inputs.flavor == 'fieldAgents') + # run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease + # - name: Assemble with Stacktrace - Calling QA release + # if: (inputs.environment == 'QA' && inputs.flavor == 'callingAgents') + # run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease + # - name: Assemble with Stacktrace - Calling PROD release + # if: (inputs.environment == 'Prod' && inputs.flavor == 'callingAgents') + # run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease + # - name: Give server ack + # if: (inputs.releaseType != 'TEST_BUILD') + # run: | + # ls + # ls -asl + # pwd + # baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} + # if [ "${{ inputs.environment }}" == "Prod" ]; then + # echo "Prod" + # baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} + # fi + # echo "$baseUrl" + # getPreSignedURL="$baseUrl/app/upload-url?appType=${{inputs.flavor}}&buildNumber=${{inputs.version_code}}&appVersion=${{inputs.version_name}}&releaseType=${{inputs.releaseType}}" + # response=$(curl --location $getPreSignedURL \ + # --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' + # ) - upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}') - id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}') + # echo "$response" + + # upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}') + # id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}') - echo "$id" + # echo "$id" - ls + # ls - apk_path="./android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}}/app-${{ inputs.flavor }}${{inputs.environment}}-release.apk" + # apk_path="./android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}}/app-${{ inputs.flavor }}${{inputs.environment}}-release.apk" - echo "$apk_path" + # echo "$apk_path" - # Check if APK exists, exit if not - if [ ! -f "$apk_path" ]; then - echo "Error: APK file not found at $apk_path" - exit 1 - fi + # # Check if APK exists, exit if not + # if [ ! -f "$apk_path" ]; then + # echo "Error: APK file not found at $apk_path" + # exit 1 + # fi - chmod +r "$apk_path" + # chmod +r "$apk_path" - curl --location --request PUT "$upload_url" \ - --data-binary "@$apk_path" + # curl --location --request PUT "$upload_url" \ + # --data-binary "@$apk_path" - echo "upload compleate" + # echo "upload compleate" - echo "ack url" + # echo "ack url" - ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType}}") + # ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType}}") - echo "$ack_url" + # echo "$ack_url" - curl --location --request PUT $ack_url \ - --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' - - name: Upload APK as Artifact - uses: actions/upload-artifact@v4 - with: - name: app-${{ inputs.type }}-v${{ inputs.version_code }}-name-${{inputs.version_name}} - path: android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}} - retention-days: 30 + # curl --location --request PUT $ack_url \ + # --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' + # - name: Upload APK as Artifact + # uses: actions/upload-artifact@v4 + # with: + # name: app-${{ inputs.type }}-v${{ inputs.version_code }}-name-${{inputs.version_name}} + # path: android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}} + # retention-days: 30 - generate_source_map: - needs: generate - runs-on: ${{ inputs.runnerType }} - outputs: - package_version: ${{ needs.generate.outputs.package_version }} - build_number: ${{ needs.generate.outputs.build_number }} - if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.MY_REPO_PAT }} - submodules: recursive + # generate_source_map: + # needs: generate + # runs-on: ${{ inputs.runnerType }} + # outputs: + # package_version: ${{ needs.generate.outputs.package_version }} + # build_number: ${{ needs.generate.outputs.build_number }} + # if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # with: + # token: ${{ secrets.MY_REPO_PAT }} + # submodules: recursive - - name: Set Node.js 16.x - uses: actions/setup-node@v3 - with: - node-version: 16.x - - name: Install yarn - run: npm install --global yarn - - name: Install dependency - run: yarn + # - name: Set Node.js 16.x + # uses: actions/setup-node@v3 + # with: + # node-version: 16.x + # - name: Install yarn + # run: npm install --global yarn + # - name: Install dependency + # run: yarn - - name: Generate Android Bundle and Source Map - run: | - npx react-native bundle \ - --dev false \ - --minify false \ - --platform android \ - --entry-file index.js \ - --reset-cache \ - --bundle-output index.android.bundle \ - --sourcemap-output index.android.bundle.map + # - name: Generate Android Bundle and Source Map + # run: | + # npx react-native bundle \ + # --dev false \ + # --minify false \ + # --platform android \ + # --entry-file index.js \ + # --reset-cache \ + # --bundle-output index.android.bundle \ + # --sourcemap-output index.android.bundle.map - - name: Compile Hermes Bytecode and Generate Source Maps - run: | - if [[ "${{inputs.runnerType}}" == "macos" ]]; then - HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" - else - HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" - fi - $HERMESC_PATH \ - -O -emit-binary \ - -output-source-map \ - -out=index.android.bundle.hbc \ - index.android.bundle + # - name: Compile Hermes Bytecode and Generate Source Maps + # run: | + # if [[ "${{inputs.runnerType}}" == "macos" ]]; then + # HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" + # else + # HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" + # fi + # $HERMESC_PATH \ + # -O -emit-binary \ + # -output-source-map \ + # -out=index.android.bundle.hbc \ + # index.android.bundle - # Remove the original bundle to prevent duplication - rm -f index.android.bundle + # # Remove the original bundle to prevent duplication + # rm -f index.android.bundle - # Rename the Hermes bundle and source map - mv index.android.bundle.hbc index.android.bundle - mv index.android.bundle.map index.android.bundle.packager.map + # # Rename the Hermes bundle and source map + # mv index.android.bundle.hbc index.android.bundle + # mv index.android.bundle.map index.android.bundle.packager.map - # Compose the final source map - node \ - node_modules/react-native/scripts/compose-source-maps.js \ - index.android.bundle.packager.map \ - index.android.bundle.hbc.map \ - -o index.android.bundle.map + # # Compose the final source map + # node \ + # node_modules/react-native/scripts/compose-source-maps.js \ + # index.android.bundle.packager.map \ + # index.android.bundle.hbc.map \ + # -o index.android.bundle.map - # Clean up the temporary files - rm -f index.android.bundle.packager.map + # # Clean up the temporary files + # rm -f index.android.bundle.packager.map - - name: Upload Source Map - uses: actions/upload-artifact@v4 - with: - name: source-map-${{inputs.version_name}} - path: index.android.bundle.map + # - name: Upload Source Map + # uses: actions/upload-artifact@v4 + # with: + # name: source-map-${{inputs.version_name}} + # path: index.android.bundle.map - upload_sourcemap_cybertron: - needs: generate_source_map - runs-on: ${{ inputs.runnerType }} - if: success() && inputs.environment == 'Prod' - steps: - - name: Download Source Map - uses: actions/download-artifact@v4 - with: - name: source-map-${{inputs.version_name}} - path: ./artifacts # Specify the folder to store the downloaded artifact + # upload_sourcemap_cybertron: + # needs: generate_source_map + # runs-on: ${{ inputs.runnerType }} + # if: success() && inputs.environment == 'Prod' + # steps: + # - name: Download Source Map + # uses: actions/download-artifact@v4 + # with: + # name: source-map-${{inputs.version_name}} + # path: ./artifacts # Specify the folder to store the downloaded artifact - - name: 'create release' - run: | - cd artifacts - ls -lh - echo creating release - response=$(curl --location --request POST '${{secrets.CYBERTRON_BASE_URL}}/api/v1/release' \ - --header 'Content-Type: application/json' \ - --data '{ - "releaseVersion": "${{ needs.generate_source_map.outputs.package_version }}", - "projectReferenceId": "${{ secrets.CYBERTRON_PROJECT_ID }}" - }') - echo $response + # - name: 'create release' + # run: | + # cd artifacts + # ls -lh + # echo creating release + # response=$(curl --location --request POST '${{secrets.CYBERTRON_BASE_URL}}/api/v1/release' \ + # --header 'Content-Type: application/json' \ + # --data '{ + # "releaseVersion": "${{ needs.generate_source_map.outputs.package_version }}", + # "projectReferenceId": "${{ secrets.CYBERTRON_PROJECT_ID }}" + # }') + # echo $response - - name: 'create presigned url' - run: | - presigned_url_source_map='${{secrets.CYBERTRON_BASE_URL}}/api/v1/get-sourcemap-upload-url?project_id=${{secrets.CYBERTRON_PROJECT_ID}}&release_id=${{ needs.generate_source_map.outputs.package_version }}&file_name=index.android.bundle.map' - response=$(curl --location $presigned_url_source_map) - echo "$response" - upload_url=$(echo "$response" | jq -r .url) - echo $upload_url - curl --location --request PUT --progress-bar --header "Content-Type: application/octet-stream" $upload_url --upload-file artifacts/index.android.bundle.map + # - name: 'create presigned url' + # run: | + # presigned_url_source_map='${{secrets.CYBERTRON_BASE_URL}}/api/v1/get-sourcemap-upload-url?project_id=${{secrets.CYBERTRON_PROJECT_ID}}&release_id=${{ needs.generate_source_map.outputs.package_version }}&file_name=index.android.bundle.map' + # response=$(curl --location $presigned_url_source_map) + # echo "$response" + # upload_url=$(echo "$response" | jq -r .url) + # echo $upload_url + # curl --location --request PUT --progress-bar --header "Content-Type: application/octet-stream" $upload_url --upload-file artifacts/index.android.bundle.map - create_release_tag: - needs: generate_source_map - runs-on: ${{ inputs.runnerType }} - if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.MY_REPO_PAT }} - submodules: recursive - persist-credentials: true - - name: Check if tag exists - id: check_tag - run: | - TAG_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." - echo "tag_exists=false" >> $GITHUB_ENV - else - echo "Tag $TAG_NAME already exists." - echo "tag_exists=true" >> $GITHUB_ENV - fi + # create_release_tag: + # needs: generate_source_map + # runs-on: ${{ inputs.runnerType }} + # if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # with: + # token: ${{ secrets.MY_REPO_PAT }} + # submodules: recursive + # persist-credentials: true + # - name: Check if tag exists + # id: check_tag + # run: | + # TAG_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." + # echo "tag_exists=false" >> $GITHUB_ENV + # else + # echo "Tag $TAG_NAME already exists." + # echo "tag_exists=true" >> $GITHUB_ENV + # fi - - name: Create and push tag - if: env.tag_exists == 'false' - run: | - TAG_NAME="${{inputs.version_name}}" - # git config --local user.email "${{ github.actor }}@github.com" - git config --local user.name "${{ github.actor }}" - git tag $TAG_NAME - git push origin $TAG_NAME --no-verify - env: - GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} - - name: Create release tag - run: | - TAG_NAME="${{inputs.version_name}}" - BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" - RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" - DESCRIPTION="${{ inputs.description }}" - REPO="navi-medici/address-verification-app" - BRANCH_NAME="${GITHUB_REF#refs/heads/}" + # - name: Create and push tag + # if: env.tag_exists == 'false' + # run: | + # TAG_NAME="${{inputs.version_name}}" + # # git config --local user.email "${{ github.actor }}@github.com" + # git config --local user.name "${{ github.actor }}" + # git tag $TAG_NAME + # git push origin $TAG_NAME --no-verify + # env: + # GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} + # - name: Create release tag + # run: | + # TAG_NAME="${{inputs.version_name}}" + # BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" + # RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" + # DESCRIPTION="${{ inputs.description }}" + # REPO="navi-medici/address-verification-app" + # BRANCH_NAME="${GITHUB_REF#refs/heads/}" - curl -X POST \ - -H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \ - -H "Content-Type: application/json" \ - -d "{ - \"tag_name\": \"$TAG_NAME\", - \"target_commitish\": \"$BRANCH_NAME\", - \"name\": \"$RELEASE_NAME\", - \"body\": \"\", - \"draft\": false, - \"prerelease\": false, - \"generate_release_notes\": true - }" \ - "https://api.github.com/repos/$REPO/releases" - shell: bash + # curl -X POST \ + # -H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \ + # -H "Content-Type: application/json" \ + # -d "{ + # \"tag_name\": \"$TAG_NAME\", + # \"target_commitish\": \"$BRANCH_NAME\", + # \"name\": \"$RELEASE_NAME\", + # \"body\": \"\", + # \"draft\": false, + # \"prerelease\": false, + # \"generate_release_notes\": true + # }" \ + # "https://api.github.com/repos/$REPO/releases" + # shell: bash From 9cf6bc90397a7fd95a23714556879bb89945cfe4 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 19:30:34 +0530 Subject: [PATCH 20/21] NTP-28802 | merge tele field workflows --- .github/workflows/hardReleaseParent.yml | 59 +-- .github/workflows/hardReleaseTele.yml | 80 ++-- .github/workflows/newBuild.yml | 558 ++++++++++++------------ 3 files changed, 361 insertions(+), 336 deletions(-) diff --git a/.github/workflows/hardReleaseParent.yml b/.github/workflows/hardReleaseParent.yml index c8f7ae2f..1f947496 100644 --- a/.github/workflows/hardReleaseParent.yml +++ b/.github/workflows/hardReleaseParent.yml @@ -1,9 +1,7 @@ -name: Trigger Child Workflows +name: Hard release on: - push: - branches: - - mergeTeleCosmos + workflow_dispatch: inputs: environment: description: Choose build environment @@ -17,8 +15,8 @@ on: required: true type: choice options: - - default - macos + - default releaseType: description: Choose release type required: true @@ -33,32 +31,42 @@ on: type: choice options: - release - version_code: - description: Enter app version code (example, 292) + version_code_tele: + description: Tele app version code (example, 292) required: true type: string default: '292' - version_name: - description: Enter app version name (example, 3.2.1) + version_name_tele: + description: Tele app version name (example, 3.2.1) + required: true + type: string + default: '3.2.1' + version_code_field: + description: Field app version code (example, 292) + required: true + type: string + default: '292' + version_name_field: + description: Field app version name (example, 3.2.1) required: true type: string default: '3.2.1' jobs: - release-field-app: - uses: ./.github/workflows/newBuild.yml # Path to the reusable workflow + field-app: + uses: ./.github/workflows/newBuild.yml with: - environment: QA #${{ github.event.inputs.environment }} - runnerType: default #${{ github.event.inputs.runnerType }} - releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} + environment: ${{ github.event.inputs.environment }} + runnerType: ${{ github.event.inputs.runnerType }} + releaseType: ${{ github.event.inputs.releaseType }} flavor: fieldAgents - type: release #${{ github.event.inputs.type }} - version_code: 100 #${{ github.event.inputs.version_code }} - version_name: 1.1.1 #${{ github.event.inputs.version_name }} + type: ${{ github.event.inputs.type }} + version_code: ${{ github.event.inputs.version_code_field }} + version_name: ${{ github.event.inputs.version_name_field }} secrets: MY_REPO_PAT: ${{ secrets.MY_REPO_PAT }} CODEPUSH_QA_KEY: ${{ secrets.CODEPUSH_QA_KEY }} - CODEPUSH_PROD_KEY: ${{ secrets.TELE_CODEPUSH_PROD_KEY }} + CODEPUSH_PROD_KEY: ${{ secrets.CODEPUSH_PROD_KEY }} PASSPHARASE: ${{ secrets.PASSPHARASE }} KEY_STORE: ${{ secrets.KEY_STORE }} LONGHORN_QA_BASE_URL: ${{ secrets.LONGHORN_QA_BASE_URL }} @@ -67,15 +75,16 @@ jobs: CYBERTRON_BASE_URL: ${{ secrets.CYBERTRON_BASE_URL }} CYBERTRON_PROJECT_ID: ${{ secrets.CYBERTRON_PROJECT_ID }} - release-tele-app: - uses: ./.github/workflows/hardReleaseTele.yml # Path to the reusable workflow + tele-app: + uses: ./.github/workflows/hardReleaseTele.yml with: - environment: QA #${{ github.event.inputs.environment }} - releaseType: TEST_BUILD #${{ github.event.inputs.releaseType }} + environment: ${{ github.event.inputs.environment }} + releaseType: ${{ github.event.inputs.releaseType }} + runnerType: ${{ github.event.inputs.runnerType }} 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 }} + type: ${{ github.event.inputs.type }} + version_code: ${{ github.event.inputs.version_code_tele }} + version_name: ${{ github.event.inputs.version_name_tele }} secrets: MY_REPO_PAT: ${{ secrets.MY_REPO_PAT }} CODEPUSH_QA_KEY: ${{ secrets.CODEPUSH_QA_KEY }} diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index e2e55663..e4a0dbd3 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -26,6 +26,9 @@ on: releaseType: required: true type: string + runnerType: + required: true + type: string flavor: required: true type: string @@ -50,10 +53,22 @@ jobs: submodules: recursive - name: update codepush key QA if: 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 + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml + else + sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml + fi + cat android/app/src/main/res/values/strings.xml - name: update codepush key PROD if: 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 + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" "s/pastekeyhere/${{ secrets.TELE_CODE_PUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml + else + sed -i "s/pastekeyhere/${{ secrets.TELE_CODE_PUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml + fi + cat android/app/src/main/res/values/strings.xml - name: Generate keystore if: inputs.type == 'release' run: echo "${{ secrets.KEY_STORE }}" > keystore.asc && gpg -d --passphrase "${{ secrets.PASSPHARASE }}" --batch keystore.asc > android/app/my-upload-key.keystore @@ -66,11 +81,21 @@ jobs: - name: Install dependency run: yarn - name: Override App Version Code - if: github.event_name == 'workflow_call' && inputs.version_code != '' - run: sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ inputs.version_code }}/g' android/app/build.gradle + if: github.event_name == 'workflow_dispatch' && inputs.version_code != '' + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle + else + sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle + fi - name: Override App Version Name - if: github.event_name == 'workflow_call' && inputs.version_name != '' - run: sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ inputs.version_name }}"/g' android/app/build.gradle + if: github.event_name == 'workflow_dispatch' && inputs.version_name != '' + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle + else + sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle + fi - name: Log Build Metadata run: | echo "Commit SHA: ${{ github.sha }}" @@ -188,33 +213,38 @@ jobs: - name: Compile Hermes Bytecode and Generate Source Maps run: | - node_modules/react-native/sdks/hermesc/linux64-bin/hermesc \ - -O -emit-binary \ - -output-source-map \ - -out=index.android.bundle.hbc \ - index.android.bundle + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" + else + HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" + fi + $HERMESC_PATH \ + -O -emit-binary \ + -output-source-map \ + -out=index.android.bundle.hbc \ + index.android.bundle - # Remove the original bundle to prevent duplication - rm -f index.android.bundle + # Remove the original bundle to prevent duplication + rm -f index.android.bundle - # Rename the Hermes bundle and source map - mv index.android.bundle.hbc index.android.bundle - mv index.android.bundle.map index.android.bundle.packager.map + # Rename the Hermes bundle and source map + mv index.android.bundle.hbc index.android.bundle + mv index.android.bundle.map index.android.bundle.packager.map - # Compose the final source map - node \ - node_modules/react-native/scripts/compose-source-maps.js \ - index.android.bundle.packager.map \ - index.android.bundle.hbc.map \ - -o index.android.bundle.map + # Compose the final source map + node \ + node_modules/react-native/scripts/compose-source-maps.js \ + index.android.bundle.packager.map \ + index.android.bundle.hbc.map \ + -o index.android.bundle.map - # Clean up the temporary files - rm -f index.android.bundle.packager.map + # Clean up the temporary files + rm -f index.android.bundle.packager.map - name: Upload Source Map uses: actions/upload-artifact@v3 with: - name: source-map + name: source-map-${{inputs.version_name}} path: index.android.bundle.map create_release_tag: diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index b0c484d2..26110d3e 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -47,323 +47,309 @@ on: type: string jobs: - logVariables: + generate: runs-on: ${{ inputs.runnerType }} + outputs: + package_version: ${{ inputs.version_name }} + build_number: ${{ inputs.version_code }} steps: - - name: Log Variables + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.MY_REPO_PAT }} + submodules: recursive + - name: Update CodePush key for QA + if: inputs.environment == 'QA' run: | - echo "Environment: ${{ inputs.environment }}" - echo "Release Type: ${{ inputs.releaseType }}" - echo "Runner Type: ${{ inputs.runnerType }}" - echo "Flavor: ${{ inputs.flavor }}" - echo "Type: ${{ inputs.type }}" - echo "Version Code: ${{ inputs.version_code }}" - echo "Version Name: ${{ inputs.version_name }}" - echo "Event_name: ${{ github.event_name }}" + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml + else + sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml + fi + cat android/app/src/main/res/values/strings.xml + - name: Update CodePush key for PROD + if: inputs.environment == 'Prod' + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml + else + sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml + fi + cat android/app/src/main/res/values/strings.xml + - name: Generate keystore + if: 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 + with: + node-version: 16.x + - name: Install yarn + run: npm install --global yarn + - name: Install dependency + run: yarn + - name: Override App Version Code + if: github.event_name == 'workflow_dispatch' && inputs.version_code != '' + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle + else + sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle + fi + - name: Override App Version Name + if: github.event_name == 'workflow_dispatch' && inputs.version_name != '' + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle + else + sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle + fi + - name: Log Build Metadata + run: | + echo "Commit SHA: ${{ github.sha }}" + echo "Build Environment: ${{ inputs.environment }}" + echo "Build 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 + uses: actions/setup-java@v3 + with: + java-version: 18 + distribution: adopt + - name: Setup Android SDK + uses: navi-synced-actions/setup-android@v2 + - name: Grant execute permission for gradlew + run: chmod +x android/gradlew + - name: Create local.properties + run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties + - name: Assemble with Stacktrace - Field QA release + if: (inputs.environment == 'QA' && inputs.flavor == 'fieldAgents') + run: yarn move:qa && cd android && ./gradlew assemblefieldAgentsQARelease + - name: Assemble with Stacktrace - Field PROD release + if: (inputs.environment == 'Prod' && inputs.flavor == 'fieldAgents') + run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease + - name: Assemble with Stacktrace - Calling QA release + if: (inputs.environment == 'QA' && inputs.flavor == 'callingAgents') + run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease + - name: Assemble with Stacktrace - Calling PROD release + if: (inputs.environment == 'Prod' && inputs.flavor == 'callingAgents') + run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease + - name: Give server ack + if: (inputs.releaseType != 'TEST_BUILD') + run: | + ls + ls -asl + pwd + baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} + if [ "${{ inputs.environment }}" == "Prod" ]; then + echo "Prod" + baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} + fi + echo "$baseUrl" + getPreSignedURL="$baseUrl/app/upload-url?appType=${{inputs.flavor}}&buildNumber=${{inputs.version_code}}&appVersion=${{inputs.version_name}}&releaseType=${{inputs.releaseType}}" + response=$(curl --location $getPreSignedURL \ + --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' + ) - # generate: - # runs-on: ${{ inputs.runnerType }} - # outputs: - # package_version: ${{ inputs.version_name }} - # build_number: ${{ inputs.version_code }} - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - # with: - # token: ${{ secrets.MY_REPO_PAT }} - # submodules: recursive - # - name: Update CodePush key for QA - # if: inputs.environment == 'QA' - # run: | - # if [[ "${{inputs.runnerType}}" == "macos" ]]; then - # sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml - # else - # sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml - # fi - # cat android/app/src/main/res/values/strings.xml - # - name: Update CodePush key for PROD - # if: inputs.environment == 'Prod' - # run: | - # if [[ "${{inputs.runnerType}}" == "macos" ]]; then - # sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml - # else - # sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml - # fi - # cat android/app/src/main/res/values/strings.xml - # - name: Generate keystore - # if: 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 - # with: - # node-version: 16.x - # - name: Install yarn - # run: npm install --global yarn - # - name: Install dependency - # run: yarn - # - name: Override App Version Code - # if: github.event_name == 'workflow_call' && inputs.version_code != '' - # run: | - # if [[ "${{inputs.runnerType}}" == "macos" ]]; then - # sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle - # else - # sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ inputs.version_code }}'/g' android/app/build.gradle - # fi - # - name: Override App Version Name - # if: github.event_name == 'workflow_call' && inputs.version_name != '' - # run: | - # if [[ "${{inputs.runnerType}}" == "macos" ]]; then - # sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle - # else - # sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ inputs.version_name }}'"/g' android/app/build.gradle - # fi - # - name: Log Build Metadata - # run: | - # echo "Commit SHA: ${{ github.sha }}" - # echo "Build Environment: ${{ inputs.environment }}" - # echo "Build 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 - # uses: actions/setup-java@v3 - # with: - # java-version: 18 - # distribution: adopt - # - name: Setup Android SDK - # uses: navi-synced-actions/setup-android@v2 - # - name: Grant execute permission for gradlew - # run: chmod +x android/gradlew - # - name: Create local.properties - # run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties - # - name: Assemble with Stacktrace - Field QA release - # if: (inputs.environment == 'QA' && inputs.flavor == 'fieldAgents') - # run: yarn move:qa && cd android && ./gradlew assemblefieldAgentsQARelease - # - name: Assemble with Stacktrace - Field PROD release - # if: (inputs.environment == 'Prod' && inputs.flavor == 'fieldAgents') - # run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - # - name: Assemble with Stacktrace - Calling QA release - # if: (inputs.environment == 'QA' && inputs.flavor == 'callingAgents') - # run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease - # - name: Assemble with Stacktrace - Calling PROD release - # if: (inputs.environment == 'Prod' && inputs.flavor == 'callingAgents') - # run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease - # - name: Give server ack - # if: (inputs.releaseType != 'TEST_BUILD') - # run: | - # ls - # ls -asl - # pwd - # baseUrl=${{secrets.LONGHORN_QA_BASE_URL}} - # if [ "${{ inputs.environment }}" == "Prod" ]; then - # echo "Prod" - # baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}} - # fi - # echo "$baseUrl" - # getPreSignedURL="$baseUrl/app/upload-url?appType=${{inputs.flavor}}&buildNumber=${{inputs.version_code}}&appVersion=${{inputs.version_name}}&releaseType=${{inputs.releaseType}}" - # response=$(curl --location $getPreSignedURL \ - # --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' - # ) + echo "$response" - # echo "$response" - - # upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}') - # id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}') + upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}') + id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}') - # echo "$id" + echo "$id" - # ls + ls - # apk_path="./android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}}/app-${{ inputs.flavor }}${{inputs.environment}}-release.apk" + apk_path="./android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}}/app-${{ inputs.flavor }}${{inputs.environment}}-release.apk" - # echo "$apk_path" + echo "$apk_path" - # # Check if APK exists, exit if not - # if [ ! -f "$apk_path" ]; then - # echo "Error: APK file not found at $apk_path" - # exit 1 - # fi + # Check if APK exists, exit if not + if [ ! -f "$apk_path" ]; then + echo "Error: APK file not found at $apk_path" + exit 1 + fi - # chmod +r "$apk_path" + chmod +r "$apk_path" - # curl --location --request PUT "$upload_url" \ - # --data-binary "@$apk_path" + curl --location --request PUT "$upload_url" \ + --data-binary "@$apk_path" - # echo "upload compleate" + echo "upload compleate" - # echo "ack url" + echo "ack url" - # ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType}}") + ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{inputs.releaseType}}") - # echo "$ack_url" + echo "$ack_url" - # curl --location --request PUT $ack_url \ - # --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' - # - name: Upload APK as Artifact - # uses: actions/upload-artifact@v4 - # with: - # name: app-${{ inputs.type }}-v${{ inputs.version_code }}-name-${{inputs.version_name}} - # path: android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}} - # retention-days: 30 + curl --location --request PUT $ack_url \ + --header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}' + - name: Upload APK as Artifact + uses: actions/upload-artifact@v4 + with: + name: app-${{ inputs.type }}-v${{ inputs.version_code }}-name-${{inputs.version_name}} + path: android/app/build/outputs/apk/${{ inputs.flavor }}${{inputs.environment}}/${{inputs.type}} + retention-days: 30 - # generate_source_map: - # needs: generate - # runs-on: ${{ inputs.runnerType }} - # outputs: - # package_version: ${{ needs.generate.outputs.package_version }} - # build_number: ${{ needs.generate.outputs.build_number }} - # if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - # with: - # token: ${{ secrets.MY_REPO_PAT }} - # submodules: recursive + generate_source_map: + needs: generate + runs-on: ${{ inputs.runnerType }} + outputs: + package_version: ${{ needs.generate.outputs.package_version }} + build_number: ${{ needs.generate.outputs.build_number }} + if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.MY_REPO_PAT }} + submodules: recursive - # - name: Set Node.js 16.x - # uses: actions/setup-node@v3 - # with: - # node-version: 16.x - # - name: Install yarn - # run: npm install --global yarn - # - name: Install dependency - # run: yarn + - name: Set Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install yarn + run: npm install --global yarn + - name: Install dependency + run: yarn - # - name: Generate Android Bundle and Source Map - # run: | - # npx react-native bundle \ - # --dev false \ - # --minify false \ - # --platform android \ - # --entry-file index.js \ - # --reset-cache \ - # --bundle-output index.android.bundle \ - # --sourcemap-output index.android.bundle.map + - name: Generate Android Bundle and Source Map + run: | + npx react-native bundle \ + --dev false \ + --minify false \ + --platform android \ + --entry-file index.js \ + --reset-cache \ + --bundle-output index.android.bundle \ + --sourcemap-output index.android.bundle.map - # - name: Compile Hermes Bytecode and Generate Source Maps - # run: | - # if [[ "${{inputs.runnerType}}" == "macos" ]]; then - # HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" - # else - # HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" - # fi - # $HERMESC_PATH \ - # -O -emit-binary \ - # -output-source-map \ - # -out=index.android.bundle.hbc \ - # index.android.bundle + - name: Compile Hermes Bytecode and Generate Source Maps + run: | + if [[ "${{inputs.runnerType}}" == "macos" ]]; then + HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc" + else + HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc" + fi + $HERMESC_PATH \ + -O -emit-binary \ + -output-source-map \ + -out=index.android.bundle.hbc \ + index.android.bundle - # # Remove the original bundle to prevent duplication - # rm -f index.android.bundle + # Remove the original bundle to prevent duplication + rm -f index.android.bundle - # # Rename the Hermes bundle and source map - # mv index.android.bundle.hbc index.android.bundle - # mv index.android.bundle.map index.android.bundle.packager.map + # Rename the Hermes bundle and source map + mv index.android.bundle.hbc index.android.bundle + mv index.android.bundle.map index.android.bundle.packager.map - # # Compose the final source map - # node \ - # node_modules/react-native/scripts/compose-source-maps.js \ - # index.android.bundle.packager.map \ - # index.android.bundle.hbc.map \ - # -o index.android.bundle.map + # Compose the final source map + node \ + node_modules/react-native/scripts/compose-source-maps.js \ + index.android.bundle.packager.map \ + index.android.bundle.hbc.map \ + -o index.android.bundle.map - # # Clean up the temporary files - # rm -f index.android.bundle.packager.map + # Clean up the temporary files + rm -f index.android.bundle.packager.map - # - name: Upload Source Map - # uses: actions/upload-artifact@v4 - # with: - # name: source-map-${{inputs.version_name}} - # path: index.android.bundle.map + - name: Upload Source Map + uses: actions/upload-artifact@v4 + with: + name: source-map-${{inputs.version_name}} + path: index.android.bundle.map - # upload_sourcemap_cybertron: - # needs: generate_source_map - # runs-on: ${{ inputs.runnerType }} - # if: success() && inputs.environment == 'Prod' - # steps: - # - name: Download Source Map - # uses: actions/download-artifact@v4 - # with: - # name: source-map-${{inputs.version_name}} - # path: ./artifacts # Specify the folder to store the downloaded artifact + upload_sourcemap_cybertron: + needs: generate_source_map + runs-on: ${{ inputs.runnerType }} + if: success() && inputs.environment == 'Prod' + steps: + - name: Download Source Map + uses: actions/download-artifact@v4 + with: + name: source-map-${{inputs.version_name}} + path: ./artifacts # Specify the folder to store the downloaded artifact - # - name: 'create release' - # run: | - # cd artifacts - # ls -lh - # echo creating release - # response=$(curl --location --request POST '${{secrets.CYBERTRON_BASE_URL}}/api/v1/release' \ - # --header 'Content-Type: application/json' \ - # --data '{ - # "releaseVersion": "${{ needs.generate_source_map.outputs.package_version }}", - # "projectReferenceId": "${{ secrets.CYBERTRON_PROJECT_ID }}" - # }') - # echo $response + - name: 'create release' + run: | + cd artifacts + ls -lh + echo creating release + response=$(curl --location --request POST '${{secrets.CYBERTRON_BASE_URL}}/api/v1/release' \ + --header 'Content-Type: application/json' \ + --data '{ + "releaseVersion": "${{ needs.generate_source_map.outputs.package_version }}", + "projectReferenceId": "${{ secrets.CYBERTRON_PROJECT_ID }}" + }') + echo $response - # - name: 'create presigned url' - # run: | - # presigned_url_source_map='${{secrets.CYBERTRON_BASE_URL}}/api/v1/get-sourcemap-upload-url?project_id=${{secrets.CYBERTRON_PROJECT_ID}}&release_id=${{ needs.generate_source_map.outputs.package_version }}&file_name=index.android.bundle.map' - # response=$(curl --location $presigned_url_source_map) - # echo "$response" - # upload_url=$(echo "$response" | jq -r .url) - # echo $upload_url - # curl --location --request PUT --progress-bar --header "Content-Type: application/octet-stream" $upload_url --upload-file artifacts/index.android.bundle.map + - name: 'create presigned url' + run: | + presigned_url_source_map='${{secrets.CYBERTRON_BASE_URL}}/api/v1/get-sourcemap-upload-url?project_id=${{secrets.CYBERTRON_PROJECT_ID}}&release_id=${{ needs.generate_source_map.outputs.package_version }}&file_name=index.android.bundle.map' + response=$(curl --location $presigned_url_source_map) + echo "$response" + upload_url=$(echo "$response" | jq -r .url) + echo $upload_url + curl --location --request PUT --progress-bar --header "Content-Type: application/octet-stream" $upload_url --upload-file artifacts/index.android.bundle.map - # create_release_tag: - # needs: generate_source_map - # runs-on: ${{ inputs.runnerType }} - # if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - # with: - # token: ${{ secrets.MY_REPO_PAT }} - # submodules: recursive - # persist-credentials: true - # - name: Check if tag exists - # id: check_tag - # run: | - # TAG_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." - # echo "tag_exists=false" >> $GITHUB_ENV - # else - # echo "Tag $TAG_NAME already exists." - # echo "tag_exists=true" >> $GITHUB_ENV - # fi + create_release_tag: + needs: generate_source_map + runs-on: ${{ inputs.runnerType }} + if: success() && inputs.environment == 'Prod' && inputs.releaseType == 'HARD_RELEASE' # Only create source map for Prod releases and not for test builds + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.MY_REPO_PAT }} + submodules: recursive + persist-credentials: true + - name: Check if tag exists + id: check_tag + run: | + TAG_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." + echo "tag_exists=false" >> $GITHUB_ENV + else + echo "Tag $TAG_NAME already exists." + echo "tag_exists=true" >> $GITHUB_ENV + fi - # - name: Create and push tag - # if: env.tag_exists == 'false' - # run: | - # TAG_NAME="${{inputs.version_name}}" - # # git config --local user.email "${{ github.actor }}@github.com" - # git config --local user.name "${{ github.actor }}" - # git tag $TAG_NAME - # git push origin $TAG_NAME --no-verify - # env: - # GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} - # - name: Create release tag - # run: | - # TAG_NAME="${{inputs.version_name}}" - # BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" - # RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" - # DESCRIPTION="${{ inputs.description }}" - # REPO="navi-medici/address-verification-app" - # BRANCH_NAME="${GITHUB_REF#refs/heads/}" + - name: Create and push tag + if: env.tag_exists == 'false' + run: | + TAG_NAME="${{inputs.version_name}}" + # git config --local user.email "${{ github.actor }}@github.com" + git config --local user.name "${{ github.actor }}" + git tag $TAG_NAME + git push origin $TAG_NAME --no-verify + env: + GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} + - name: Create release tag + run: | + TAG_NAME="${{inputs.version_name}}" + BUILD_NUMBER="${{ needs.generate.outputs.build_number }}" + RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push" + DESCRIPTION="${{ inputs.description }}" + REPO="navi-medici/address-verification-app" + BRANCH_NAME="${GITHUB_REF#refs/heads/}" - # curl -X POST \ - # -H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \ - # -H "Content-Type: application/json" \ - # -d "{ - # \"tag_name\": \"$TAG_NAME\", - # \"target_commitish\": \"$BRANCH_NAME\", - # \"name\": \"$RELEASE_NAME\", - # \"body\": \"\", - # \"draft\": false, - # \"prerelease\": false, - # \"generate_release_notes\": true - # }" \ - # "https://api.github.com/repos/$REPO/releases" - # shell: bash + curl -X POST \ + -H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"$TAG_NAME\", + \"target_commitish\": \"$BRANCH_NAME\", + \"name\": \"$RELEASE_NAME\", + \"body\": \"\", + \"draft\": false, + \"prerelease\": false, + \"generate_release_notes\": true + }" \ + "https://api.github.com/repos/$REPO/releases" + shell: bash From 49ac3bd224e365870030a251ccc2d0328bc6c882 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Tue, 21 Jan 2025 19:32:41 +0530 Subject: [PATCH 21/21] NTP-28802 | merge tele field workflows --- .github/workflows/hardReleaseTele.yml | 4 ++-- .github/workflows/newBuild.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hardReleaseTele.yml b/.github/workflows/hardReleaseTele.yml index e4a0dbd3..c97d4af5 100644 --- a/.github/workflows/hardReleaseTele.yml +++ b/.github/workflows/hardReleaseTele.yml @@ -1,4 +1,4 @@ -name: generate-apk-tele +name: hard-release-tele on: workflow_call: @@ -43,7 +43,7 @@ on: type: string jobs: - generate: + generate_build: runs-on: [ default ] steps: - name: Checkout diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 26110d3e..8a128340 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -1,4 +1,4 @@ -name: generate-apk +name: hard-release-field on: workflow_call: @@ -47,7 +47,7 @@ on: type: string jobs: - generate: + generate_build: runs-on: ${{ inputs.runnerType }} outputs: package_version: ${{ inputs.version_name }}