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.
This commit is contained in:
Ryan Foster
2025-07-02 16:26:17 -04:00
parent d91ccdefd2
commit 8501c45390

View File

@@ -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]) )