From 4a3fdc175cdfac6dad5e4a756fa4a92ccca2c5d1 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 12 May 2024 14:58:27 +0200 Subject: [PATCH] ci: Skip release jobs on outdated tags This happens a commit is pushed to main while the pipelines have not finished for the previous commit. In this case the devel-tag pipelines will run concurrently, leading to unpredictable results for the devel release. --- .github/workflows/ci.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 258af85f8..d69d7c558 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,8 +10,9 @@ on: - v* concurrency: - # Terminate all previous runs of the same workflow for pull requests - group: ci-${{ github.head_ref || github.run_id }} + # Terminate all previous runs of the same workflow for the same tag, but never + # cancel for the main / release branch pipelines. + group: ci-${{ (github.ref_type == 'tag' && github.ref) || github.run_id }} cancel-in-progress: true jobs: @@ -103,6 +104,10 @@ jobs: tag: name: Release / Tag + concurrency: + # Never tag outdated commits on the main branch by skipping superseded commits + group: ci-tag-${{ (github.ref == 'refs/heads/main' && github.ref) || github.run_id }} + cancel-in-progress: true if: | startsWith(github.ref, 'refs/heads/') && needs.docs.result == 'success' &&