From 60acaf3eea7beb802b3ff541fa6526ba227ccffe Mon Sep 17 00:00:00 2001 From: SuperDooper <37051355+superdooper86@users.noreply.github.com> Date: Mon, 11 May 2026 20:45:03 +0200 Subject: [PATCH] CI: update Win Stable badge and clear Win Beta on stable release --- .github/workflows/release-windows.yml | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index 63d9921..a90c340 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -75,3 +75,35 @@ jobs: --field "content=$content" \ --field "branch=main" fi + + - name: Update Windows stable badge in README on main + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + shell: bash + run: | + version="${{ steps.version.outputs.version }}" + tag="${{ github.ref_name }}" + shields_version=$(echo "$version" | sed 's/-/--/g') + export WIN_STABLE_BADGE="[![Win Stable](https://img.shields.io/badge/Win_Stable-${shields_version}-blue?style=flat)](https://github.com/${{ github.repository }}/releases/tag/${tag}) " + sha=$(gh api "repos/${{ github.repository }}/contents/README.md?ref=main" --jq .sha) + content=$(gh api "repos/${{ github.repository }}/contents/README.md?ref=main" --jq .content | python3 -c " + import sys, base64, os + raw = sys.stdin.read().strip() + text = base64.b64decode(raw).decode() + stable_badge = os.environ['WIN_STABLE_BADGE'] + lines = text.splitlines(keepends=True) + out = [] + for line in lines: + if '' in line: + out.append(stable_badge + chr(10)) + elif '' in line: + out.append('' + chr(10)) + else: + out.append(line) + print(base64.b64encode(''.join(out).encode()).decode(), end='') + ") + gh api --method PUT "repos/${{ github.repository }}/contents/README.md" \ + --field "message=Windows stable badge $tag" \ + --field "content=$content" \ + --field "branch=main" \ + --field "sha=$sha"