From ad46ca4da351be7ad5aa1256d7849b8e1e0d40e8 Mon Sep 17 00:00:00 2001 From: fredericfran-gds Date: Wed, 20 Jul 2022 16:47:17 +0100 Subject: [PATCH] fix deploy workflow & add automatic deploy workflow --- .github/workflows/deploy.yaml | 8 ++-- .../set-automatic-deploys-enabled.yaml | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/set-automatic-deploys-enabled.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a11e3b0d7..9ca85fbb1 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -39,9 +39,9 @@ jobs: uses: alphagov/govuk-infrastructure/.github/workflows/deploy.yaml@main with: imageTag: ${{ needs.build-and-publish-image.outputs.imageTag }} - manualDeploy: ${{ 'main' != github.event.inputs.gitRef }} - environment: ${{ github.event.inputs.environment || 'integration' }} + workflowTrigger: ${{ github.event_name }} + environment: ${{ github.event.inputs.environment }} secrets: - WEBHOOK_TOKEN: ${{ secrets.ARGO_EVENTS_WEBHOOK_TOKEN }} - WEBHOOK_URL: ${{ secrets.ARGO_EVENTS_WEBHOOK_URL }} + WEBHOOK_TOKEN: ${{ secrets.GOVUK_INTEGRATION_ARGO_EVENTS_WEBHOOK_TOKEN }} + WEBHOOK_URL: ${{ secrets.GOVUK_INTEGRATION_ARGO_EVENTS_WEBHOOK_URL }} GOVUK_CI_GITHUB_API_TOKEN: ${{ secrets.GOVUK_CI_GITHUB_API_TOKEN }} diff --git a/.github/workflows/set-automatic-deploys-enabled.yaml b/.github/workflows/set-automatic-deploys-enabled.yaml new file mode 100644 index 000000000..217b0ecba --- /dev/null +++ b/.github/workflows/set-automatic-deploys-enabled.yaml @@ -0,0 +1,37 @@ +name: Set automatic_deploys_enabled (optionally image_tag too) + +on: + workflow_dispatch: + inputs: + resetImageTag: + description: 'Reset image tag to main' + required: false + default: false + type: boolean + automaticDeploysEnabled: + description: 'Activate automatic deploys' + required: false + default: true + type: boolean + environment: + description: 'Environment to deploy to' + required: true + type: choice + options: + - integration + - staging + - production + default: 'integration' + +jobs: + set_automatic_deploys_enabled: + name: Set automatic_deploys_enabled to ${{ github.event.inputs.environment }} + uses: alphagov/govuk-infrastructure/.github/workflows/set-automatic-deploys-enabled.yaml@main + with: + resetImageTag: ${{ github.event.inputs.resetImageTag == 'true' }} + automaticDeploysEnabled: ${{ github.event.inputs.automaticDeploysEnabled == 'true' }} + environment: ${{ github.event.inputs.environment }} + secrets: + WEBHOOK_TOKEN: ${{ secrets.GOVUK_INTEGRATION_ARGO_EVENTS_WEBHOOK_TOKEN }} + WEBHOOK_URL: ${{ secrets.GOVUK_INTEGRATION_ARGO_EVENTS_WEBHOOK_URL }} + GOVUK_CI_GITHUB_API_TOKEN: ${{ secrets.GOVUK_CI_GITHUB_API_TOKEN }}