From 12d22a35df39812906137a0958c6882c81517a8c Mon Sep 17 00:00:00 2001 From: Melad Raouf Date: Wed, 19 Feb 2025 12:09:08 +0200 Subject: [PATCH 1/2] Fix release pipeline --- .../workflows/pipeline-deploy-to-internal.yml | 16 +---- .../workflows/pipeline-deploy-to-staging.yml | 1 + ...usable-deploy-to-firebase-distribution.yml | 2 +- .../workflows/reusable-get-version-name.yml | 2 +- .../workflows/reusable-promote-artifact.yml | 72 +++++++++++-------- .github/workflows/reusable-sonar-scan.yml | 9 ++- build-logic/build_properties.gradle.kts | 2 +- 7 files changed, 57 insertions(+), 47 deletions(-) diff --git a/.github/workflows/pipeline-deploy-to-internal.yml b/.github/workflows/pipeline-deploy-to-internal.yml index b95d4c3704..78d359d8e8 100644 --- a/.github/workflows/pipeline-deploy-to-internal.yml +++ b/.github/workflows/pipeline-deploy-to-internal.yml @@ -13,6 +13,7 @@ jobs: build-internal-aab: uses: ./.github/workflows/reusable-build-apk.yml secrets: inherit + needs: get-version with: build-environment: internal version-name: ${{ needs.get-version.outputs.version-name }} @@ -28,21 +29,10 @@ jobs: deploy-internal-build: uses: ./.github/workflows/reusable-promote-artifact.yml + secrets: inherit with: - deployment-track: internal - upload-artifact: ${{ needs.build-internal-aab.outputs.build-artifact }} - mapping-file: ${{ needs.build-internal-aab.outputs.optional-mapping-file }} - needs: - - build-internal-aab - - run-app-sweep - - deploy-alpha-build: - uses: ./.github/workflows/reusable-promote-artifact.yml - with: - deployment-track: alpha + deployment-track: Internal upload-artifact: ${{ needs.build-internal-aab.outputs.build-artifact }} mapping-file: ${{ needs.build-internal-aab.outputs.optional-mapping-file }} needs: - build-internal-aab - - run-app-sweep - - deploy-internal-build diff --git a/.github/workflows/pipeline-deploy-to-staging.yml b/.github/workflows/pipeline-deploy-to-staging.yml index a87939a719..d07c92b4ea 100644 --- a/.github/workflows/pipeline-deploy-to-staging.yml +++ b/.github/workflows/pipeline-deploy-to-staging.yml @@ -13,6 +13,7 @@ jobs: build-staging-apk: uses: ./.github/workflows/reusable-build-apk.yml secrets: inherit + needs: get-version with: build-environment: staging version-name: ${{ needs.get-version.outputs.version-name }} diff --git a/.github/workflows/reusable-deploy-to-firebase-distribution.yml b/.github/workflows/reusable-deploy-to-firebase-distribution.yml index 27eebc1f01..c602cb5bd0 100644 --- a/.github/workflows/reusable-deploy-to-firebase-distribution.yml +++ b/.github/workflows/reusable-deploy-to-firebase-distribution.yml @@ -61,7 +61,7 @@ jobs: console_url="$(echo "$output" | grep -o 'https://console\.firebase\.google\.com[^[:space:]]*')" # Expose console_url as a step output using $GITHUB_OUTPUT - echo "console_url=$console_url" >> "$GITHUB_OUTPUT" + echo "console_url=$console_url" >> $GITHUB_OUTPUT - name: Distribution Summary run: | diff --git a/.github/workflows/reusable-get-version-name.yml b/.github/workflows/reusable-get-version-name.yml index c0dfe775e4..d57045650d 100644 --- a/.github/workflows/reusable-get-version-name.yml +++ b/.github/workflows/reusable-get-version-name.yml @@ -31,7 +31,7 @@ jobs: run: | if [ "${{ inputs.version-source }}" = "branch" ]; then last_part="${GITHUB_REF_NAME##*/}" - echo "version-name=$last_part" >> "$GITHUB_OUTPUT" + echo "version-name=$last_part" >> $GITHUB_OUTPUT elif [ "${{ inputs.version-source }}" = "internal" ]; then VERSION_NAME=$(grep 'set("VERSION_NAME"' build-logic/build_properties.gradle.kts \ | sed -E 's/.*set\("VERSION_NAME",[[:space:]]*"([^"]+)".*/\1/') diff --git a/.github/workflows/reusable-promote-artifact.yml b/.github/workflows/reusable-promote-artifact.yml index f60942d7ac..4a28630207 100644 --- a/.github/workflows/reusable-promote-artifact.yml +++ b/.github/workflows/reusable-promote-artifact.yml @@ -46,35 +46,47 @@ jobs: - name: Set vars run: | - if [ "${{inputs.deployment-track}}" == "Internal" ]; then - STATUS="completed" - USER_FRACTION=1.0 - TRACK="qa" - elif [ "${{inputs.deployment-track}}" == "Alpha" ]; then - STATUS="completed" - USER_FRACTION=1.0 - TRACK="alpha" - elif [ "${{inputs.deployment-track}}" == "Prod-25-Percent-Rollout" ]; then - STATUS="inProgress" - USER_FRACTION=0.25 - TRACK="production" - elif [ "${{inputs.deployment-track}}" == "Prod-50-Percent-Rollout" ]; then - STATUS="inProgress" - USER_FRACTION=0.5 - TRACK="production" - elif [ "${{inputs.deployment-track}}" == "Prod-100-Percent-Rollout" ]; then - STATUS="completed" - USER_FRACTION=1.0 - TRACK="production" + if [ "${{ inputs.deployment-track }}" == "Internal" ]; then + echo "STATUS=completed" >> $GITHUB_ENV + echo "USER_FRACTION=1.0" >> $GITHUB_ENV + echo "TRACK=internal" >> $GITHUB_ENV + elif [ "${{ inputs.deployment-track }}" == "Alpha" ]; then + echo "STATUS=completed" >> $GITHUB_ENV + echo "USER_FRACTION=1.0" >> $GITHUB_ENV + echo "TRACK=alpha" >> $GITHUB_ENV + elif [ "${{ inputs.deployment-track }}" == "Prod-25-Percent-Rollout" ]; then + echo "STATUS=inProgress" >> $GITHUB_ENV + echo "USER_FRACTION=0.25" >> $GITHUB_ENV + echo "TRACK=production" >> $GITHUB_ENV + elif [ "${{ inputs.deployment-track }}" == "Prod-50-Percent-Rollout" ]; then + echo "STATUS=inProgress" >> $GITHUB_ENV + echo "USER_FRACTION=0.5" >> $GITHUB_ENV + echo "TRACK=production" >> $GITHUB_ENV + elif [ "${{ inputs.deployment-track }}" == "Prod-100-Percent-Rollout" ]; then + echo "STATUS=completed" >> $GITHUB_ENV + echo "USER_FRACTION=1.0" >> $GITHUB_ENV + echo "TRACK=production" >> $GITHUB_ENV fi - - name: Publish app to track - uses: r0adkll/upload-google-play@v1 - with: - serviceAccountJsonPlainText: ${{secrets.GOOGLE_API_KEY_JSON}} - packageName: com.simprints.id - releaseFiles: ${{ inputs.upload-artifact }} - track: $TRACK - status: $STATUS - userFraction: $USER_FRACTION - mappingFile: ${{ inputs.mapping-file }} + + - name: Publish app (Completed Release) + if: env.STATUS == 'completed' + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.GOOGLE_API_KEY_JSON }} + packageName: com.simprints.id + releaseFiles: ${{ inputs.upload-artifact }} + track: ${{ env.TRACK }} + mappingFile: ${{ inputs.mapping-file }} + + - name: Publish app (Rollout Release) + if: env.STATUS == 'inProgress' + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.GOOGLE_API_KEY_JSON }} + packageName: com.simprints.id + releaseFiles: ${{ inputs.upload-artifact }} + track: ${{ env.TRACK }} + status: ${{ env.STATUS }} + userFraction: ${{ env.USER_FRACTION }} + mappingFile: ${{ inputs.mapping-file }} diff --git a/.github/workflows/reusable-sonar-scan.yml b/.github/workflows/reusable-sonar-scan.yml index f1a6c758a1..c53c0a1aa6 100644 --- a/.github/workflows/reusable-sonar-scan.yml +++ b/.github/workflows/reusable-sonar-scan.yml @@ -69,4 +69,11 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ./gradlew sonar -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=3600 --info + # Check if the event is a pull request + if [ "${{ github.event_name }}" == "pull_request" ]; then + # Run SonarQube scan without branch name param as sonarqube will detect PR branch + ./gradlew sonar -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=3600 --info + else + # Run SonarQube scan with branch name param + ./gradlew sonar -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=3600 -Dsonar.branch.name=${{ github.ref_name }} --info + fi diff --git a/build-logic/build_properties.gradle.kts b/build-logic/build_properties.gradle.kts index 0edcb6e1b3..50da31676a 100644 --- a/build-logic/build_properties.gradle.kts +++ b/build-logic/build_properties.gradle.kts @@ -17,7 +17,7 @@ extra.apply { * Dev version >= 2024.2.2 is required for float quality thresholds * Dev version >= 2024.3.0 is required to receive configuration ID */ - set("VERSION_NAME", "2024.3.0") + set("VERSION_NAME", "2025.1.0") /** * Build type. The version code describes which build type was used for the build. From 2287bec5b72abf440f552473d21f6967f94a9c8f Mon Sep 17 00:00:00 2001 From: Melad Raouf Date: Wed, 19 Feb 2025 12:41:55 +0200 Subject: [PATCH 2/2] Capitalize build-environment and environment values in pipeline and reusable files --- .github/workflows/pipeline-deploy-to-internal.yml | 2 +- .github/workflows/pipeline-deploy-to-staging.yml | 4 ++-- .github/workflows/reusable-app-sweep.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pipeline-deploy-to-internal.yml b/.github/workflows/pipeline-deploy-to-internal.yml index 78d359d8e8..dfd54fda62 100644 --- a/.github/workflows/pipeline-deploy-to-internal.yml +++ b/.github/workflows/pipeline-deploy-to-internal.yml @@ -15,7 +15,7 @@ jobs: secrets: inherit needs: get-version with: - build-environment: internal + build-environment: Internal version-name: ${{ needs.get-version.outputs.version-name }} run-app-sweep: diff --git a/.github/workflows/pipeline-deploy-to-staging.yml b/.github/workflows/pipeline-deploy-to-staging.yml index d07c92b4ea..9a53cb5a8a 100644 --- a/.github/workflows/pipeline-deploy-to-staging.yml +++ b/.github/workflows/pipeline-deploy-to-staging.yml @@ -15,7 +15,7 @@ jobs: secrets: inherit needs: get-version with: - build-environment: staging + build-environment: Staging version-name: ${{ needs.get-version.outputs.version-name }} deploy-to-firebase: @@ -24,5 +24,5 @@ jobs: needs: - build-staging-apk with: - build-environment: staging + build-environment: Staging upload-artifact: ${{ needs.build-staging-apk.outputs.build-artifact }} diff --git a/.github/workflows/reusable-app-sweep.yml b/.github/workflows/reusable-app-sweep.yml index 15c7c72f7a..1181d7c507 100644 --- a/.github/workflows/reusable-app-sweep.yml +++ b/.github/workflows/reusable-app-sweep.yml @@ -16,7 +16,7 @@ jobs: name: App Sweep Security Scan runs-on: ubuntu-latest timeout-minutes: ${{ fromJSON(vars.JOB_TIMEOUT_MINUTES) }} - environment: internal + environment: Internal steps: - name: Download AAB artifact