From 1df97769763e0e2c18fccf6e02cdc1487dbf0b05 Mon Sep 17 00:00:00 2001 From: Daniel Emery Date: Thu, 29 Feb 2024 11:24:12 +0100 Subject: [PATCH] Add concurrency flag to each job to resolve race conditions --- .github/workflows/deploy-existing-release.yml | 5 +++++ .github/workflows/main.yml | 5 +++++ .github/workflows/publish-new-release.yml | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/.github/workflows/deploy-existing-release.yml b/.github/workflows/deploy-existing-release.yml index 6e46a8b..0188ce3 100644 --- a/.github/workflows/deploy-existing-release.yml +++ b/.github/workflows/deploy-existing-release.yml @@ -3,6 +3,11 @@ name: Deploy Existing Release on: workflow_dispatch: +# Ensure only one instance of either this or the publish workflow is running at a time +# This ensures that we don't put production into an inconsistent state +concurrency: + group: 'prod-deployment' + jobs: deploy: runs-on: ubuntu-latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e55ecf4..73530f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,11 @@ on: push: branches: ["main"] +# Ensure only one instance of the workflow is running at a time +# This helps with race conditions when upserting releases +concurrency: + group: 'main' + env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} diff --git a/.github/workflows/publish-new-release.yml b/.github/workflows/publish-new-release.yml index 1bf80ae..073c352 100644 --- a/.github/workflows/publish-new-release.yml +++ b/.github/workflows/publish-new-release.yml @@ -3,6 +3,11 @@ name: Publish New Release on: workflow_dispatch: +# Ensure only one instance of either this or the deploy workflow is running at a time +# This ensures that we don't put production into an inconsistent state +concurrency: + group: 'prod-deployment' + jobs: deploy: runs-on: ubuntu-latest