From 34e2cf29f05f7ba2ad8bf110092865a764850dbe Mon Sep 17 00:00:00 2001 From: Lan Liang Date: Thu, 18 Jul 2024 08:36:03 +0000 Subject: [PATCH] Only update krew index for latest stable version. Signed-off-by: Lan Liang --- .github/workflows/release.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48dda9e8de1c..aa9302b96563 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -108,8 +108,29 @@ jobs: with: files: | sbom.tar.gz + + get-stable-tag: + name: Get Stable tag + runs-on: ubuntu-22.04 + env: + GH_TOKEN: ${{ github.token }} + outputs: + stableTag: ${{ steps.get.outputs.stableTag }} + steps: + - name: get + id: get + run: | + # get the max version from tags list and filter versions of alpha,beta,preview,rc + export STABLE_TAG=`gh api repos/karmada-io/karmada/tags --paginate | jq -r '.[].name' | grep -Ev "alpha|beta|preview|rc" | sort -Vr | head -n 1` + echo "Got the stabe tag:$STABLE_TAG" + echo "event.tag:"${{ github.event.release.tag_name }} + echo "stableTag=$STABLE_TAG" >> "$GITHUB_OUTPUT" + update-krew-index: - needs: release-assests + needs: + - release-assests + - get-stable-tag + if: needs.get-stable-tag.outputs.stableTag == github.event.release.tag_name name: Update krew-index runs-on: ubuntu-22.04 steps: