diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 8479c66e62d..d493a5bedb1 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -33,11 +33,14 @@ jobs: env: INPUT_VERSION: ${{ inputs.version }} GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} run: | set -euo pipefail - latest=$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name) - [[ "$latest" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Latest release tag '${latest}' is not x.y.z"; exit 1; } + latest=$(gh release list --limit 100 --exclude-drafts --exclude-pre-releases \ + --json tagName --jq '.[].tagName' \ + | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | grep -v '^9\.9\.' | sort -V | tail -1) + [[ -n "$latest" ]] || { echo "No x.y.z releases found"; exit 1; } IFS='.' read -r cur_major cur_minor cur_patch <<< "$latest" if [ -z "$INPUT_VERSION" ]; then