From 90dcf4dff0f48ed5537d6ea22efdca8e91f2f013 Mon Sep 17 00:00:00 2001 From: Sean Rankine Date: Fri, 29 Apr 2022 16:06:12 +0100 Subject: [PATCH] Update GHA to enable manual deploys This updates the deploy GitHub Action workflow to add the ability to trigger manual one off deploys of specific commits. The workflow now accepts a gitRef input that can be either commit SHA, branch name or a git tag. If a branch name is given, the latest commit on that branch is used. The workflow will build the image for that commit and trigger its deployment to integration. The workflow is still used to build images and trigger continuous deployment for new releases. The workflow has also been renamed from CI to Deploy to better clarify its purpose. --- .github/workflows/{ci.yaml => deploy.yaml} | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) rename .github/workflows/{ci.yaml => deploy.yaml} (67%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/deploy.yaml similarity index 67% rename from .github/workflows/ci.yaml rename to .github/workflows/deploy.yaml index 98fd465c5..1ff14b015 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/deploy.yaml @@ -1,9 +1,13 @@ -name: CI +name: Deploy on: workflow_dispatch: - branches: - - main + inputs: + gitRef: + description: 'Commit, tag or branch name to deploy' + required: true + type: string + default: 'main' push: branches: - main @@ -15,6 +19,8 @@ jobs: build-and-publish-image: name: Build and publish image uses: alphagov/govuk-infrastructure/.github/workflows/ci-ecr.yaml@main + with: + gitRef: ${{ github.event.inputs.gitRef }} secrets: AWS_GOVUK_ECR_ACCESS_KEY_ID: ${{ secrets.AWS_GOVUK_ECR_ACCESS_KEY_ID }} AWS_GOVUK_ECR_SECRET_ACCESS_KEY: ${{ secrets.AWS_GOVUK_ECR_SECRET_ACCESS_KEY }} @@ -22,6 +28,9 @@ jobs: name: Trigger deploy to integration needs: build-and-publish-image uses: alphagov/govuk-infrastructure/.github/workflows/deploy.yaml@main + with: + imageTag: ${{ needs.build-and-publish-image.outputs.imageTag }} + manualDeploy: ${{ 'main' != github.event.inputs.gitRef }} secrets: WEBHOOK_TOKEN: ${{ secrets.ARGO_EVENTS_WEBHOOK_TOKEN }} WEBHOOK_URL: ${{ secrets.ARGO_EVENTS_WEBHOOK_URL }}