From cafcff722b2db5da37e99f0a9810a50b7c432138 Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Mon, 18 Nov 2024 12:14:03 +0100 Subject: [PATCH 1/2] ci: ensure version is stored when deploying apps --- .github/workflows/ci-cd-prod.yml | 2 +- .github/workflows/ci-cd-staging.yml | 2 +- .github/workflows/ci-cd-yt01.yml | 2 +- .github/workflows/workflow-deploy-apps.yml | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-cd-prod.yml b/.github/workflows/ci-cd-prod.yml index c9e68aa0d..3fa558c4b 100644 --- a/.github/workflows/ci-cd-prod.yml +++ b/.github/workflows/ci-cd-prod.yml @@ -130,7 +130,7 @@ jobs: store-apps-version: name: Store Latest Deployed Apps Version as GitHub Variable needs: [deploy-apps, get-current-version] - if: ${{ needs.deploy-apps.result == 'success' }} + if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.deploy-apps.outputs.deployment_executed == 'true') }} uses: ./.github/workflows/workflow-store-github-env-variable.yml with: variable_name: LATEST_DEPLOYED_APPS_VERSION diff --git a/.github/workflows/ci-cd-staging.yml b/.github/workflows/ci-cd-staging.yml index 2ff5247e3..5091b5238 100644 --- a/.github/workflows/ci-cd-staging.yml +++ b/.github/workflows/ci-cd-staging.yml @@ -96,7 +96,7 @@ jobs: store-apps-version: name: Store Latest Deployed Apps Version as GitHub Variable needs: [deploy-apps, get-current-version] - if: ${{ needs.deploy-apps.result == 'success' }} + if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.deploy-apps.outputs.deployment_executed == 'true') }} uses: ./.github/workflows/workflow-store-github-env-variable.yml with: variable_name: LATEST_DEPLOYED_APPS_VERSION diff --git a/.github/workflows/ci-cd-yt01.yml b/.github/workflows/ci-cd-yt01.yml index 1dee21b98..734ff03ed 100644 --- a/.github/workflows/ci-cd-yt01.yml +++ b/.github/workflows/ci-cd-yt01.yml @@ -98,7 +98,7 @@ jobs: store-apps-version: name: Store Latest Deployed Apps Version as GitHub Variable needs: [deploy-apps, get-current-version] - if: ${{ needs.deploy-apps.result == 'success' }} + if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.deploy-apps.outputs.deployment_executed == 'true') }} uses: ./.github/workflows/workflow-store-github-env-variable.yml with: variable_name: LATEST_DEPLOYED_APPS_VERSION diff --git a/.github/workflows/workflow-deploy-apps.yml b/.github/workflows/workflow-deploy-apps.yml index 2341d0081..6058c97c9 100644 --- a/.github/workflows/workflow-deploy-apps.yml +++ b/.github/workflows/workflow-deploy-apps.yml @@ -3,6 +3,10 @@ env: AZ_CLI_VERSION: 2.64.0 on: workflow_call: + outputs: + deployment_executed: + description: "Indicates if the deployment was actually executed" + value: ${{ jobs.deploy-apps.result == 'success' }} secrets: AZURE_CLIENT_ID: required: true From 8c635d718a95ccd289d953910f0cd83ab94ea3f5 Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Mon, 18 Nov 2024 12:24:10 +0100 Subject: [PATCH 2/2] ci: ensure version is stored when deploying apps --- .github/workflows/workflow-deploy-apps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-deploy-apps.yml b/.github/workflows/workflow-deploy-apps.yml index 6058c97c9..ae0d5379a 100644 --- a/.github/workflows/workflow-deploy-apps.yml +++ b/.github/workflows/workflow-deploy-apps.yml @@ -6,7 +6,7 @@ on: outputs: deployment_executed: description: "Indicates if the deployment was actually executed" - value: ${{ jobs.deploy-apps.result == 'success' }} + value: ${{ jobs.deploy-apps.result == 'success' && jobs.deploy-jobs.result == 'success' && !inputs.dryRun }} secrets: AZURE_CLIENT_ID: required: true