From 89a6487892e637712c00efe017c5b52258831bbd Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Tue, 28 Jul 2026 20:12:12 -0700 Subject: [PATCH] fix(ci): harden desktop prerelease tag computation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An empty stable release list makes `gh ... --jq '.[0].tagName'` print the literal string "null", which `${LATEST:-v0.0.0}` does not treat as empty, producing a malformed tag like `vnull..1-beta.N`. The `|| true` also swallowed a failed release query, silently falling back to v0.0.0 and publishing a channel build that sorts below the shipped stable — installed shells would never see it as an update. --- .github/workflows/ci.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 887e4ed5baa..0f038327feb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -710,8 +710,19 @@ jobs: # and are always superseded by the next stable. The run-attempt # suffix keeps re-runs of the same workflow from colliding on the # tag while preserving semver ordering. - LATEST="$(gh release list --exclude-pre-releases --limit 1 --json tagName --jq '.[0].tagName' || true)" - LATEST="${LATEST:-v0.0.0}" + # Fail loudly if the query itself fails: silently falling back to + # v0.0.0 would publish a channel build that sorts below the shipped + # stable, and installed shells would never see it as an update. + if ! LATEST="$(gh release list --exclude-pre-releases --limit 1 --json tagName --jq '.[0].tagName')"; then + echo "::error::Could not query the latest stable release." + exit 1 + fi + # An empty release list makes jq print "null", which ${VAR:-default} + # does not treat as empty. Anything that is not a bare vX.Y.Z means + # "no stable release to build on top of" — start the channel at 0.0.1. + if [[ ! "$LATEST" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + LATEST="v0.0.0" + fi IFS='.' read -r MAJOR MINOR PATCH <<< "${LATEST#v}" TAG="v${MAJOR}.${MINOR}.$((PATCH + 1))-${CHANNEL}.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}" NOTES="Automated ${CHANNEL}-channel desktop build from ${GITHUB_REF_NAME} @ ${GITHUB_SHA::7}."