From 0a7fb4c8810b6917c3c1e57f74ad4b6cb3ca59b3 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Tue, 18 Jul 2023 14:33:44 +0200 Subject: [PATCH] Reimplemented canary builds on `main` refs https://github.com/TryGhost/DevOps/issues/47 - this adds a canary job that waits for successful tests and then kicks off the Docker build step --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de9de86508..a68114f96c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -749,3 +749,27 @@ jobs: if: contains(needs.*.result, 'failure') run: | echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1 + + canary: + needs: [ + job_get_metadata, + job_required_tests + ] + name: Canary + runs-on: ubuntu-latest + if: always() && needs.job_get_metadata.outputs.is_canary_branch == 'true' && !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped')) + steps: + - name: Set env variables + run: | + echo "CANARY_BUILD_INPUTS={\"version\":\"canary\",\"environment\":\"staging\"}" >> $GITHUB_ENV + + - name: Invoke build + uses: aurelien-baudet/workflow-dispatch@v2 + with: + token: ${{ secrets.CANARY_DOCKER_BUILD }} + workflow: .github/workflows/deploy.yml + ref: 'refs/heads/main' + repo: TryGhost/Ghost-Moya + inputs: ${{ env.CANARY_BUILD_INPUTS }} + wait-for-completion-timeout: 25m + wait-for-completion-interval: 30s