From 8501c4539015c46ee770bce0226aed5fbd99ef02 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Wed, 2 Jul 2025 16:26:17 -0400 Subject: [PATCH] CI: Prevent hotfixes from overwriting Flathub beta When 31.0.4 was published, it published to the Flathub beta channel, which overwrote the running 31.1.0 beta/rc. This was due to an assumption that we would not publish an out-of-band hotfix release once we had moved to a new beta release cycle. To prevent this in the future, we can check the last two releases to see if they are different tag series and if one is a prerelease. --- .github/workflows/publish.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b7d8483a3..cc12f94f7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -29,10 +29,17 @@ jobs: if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi shopt -s extglob + read -r is_last_tag_newer_prerelease <<< \ + "$(gh release list --exclude-drafts --limit 2 --json "isPrerelease,tagName" \ + --jq '.[] | select((.tagName | contains("${GITHUB_REF_NAME%%-*}") | not) and (.isPrerelease == true))')" case "${GITHUB_REF_NAME}" in +([0-9]).+([0-9]).+([0-9]) ) echo 'validTag=true' >> $GITHUB_OUTPUT - echo 'flatpakMatrix=["beta", "stable"]' >> $GITHUB_OUTPUT + if [[ "${is_last_tag_newer_prerelease}" ]]; then + echo 'flatpakMatrix=["stable"]' >> $GITHUB_OUTPUT + else + echo 'flatpakMatrix=["beta", "stable"]' >> $GITHUB_OUTPUT + fi echo 'updateChannel=stable' >> $GITHUB_OUTPUT ;; +([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )