From 7cb52441f54ca5e258bff9c13f2d3649cf3714a7 Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Thu, 14 Nov 2024 10:26:21 +0000 Subject: [PATCH] Replace `stable` in regex --- .github/workflows/release.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e8a53b9..7d34c20b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,23 @@ jobs: - name: Checkout source uses: actions/checkout@v4 + - name: Replace stable version with the release version + run: |- + # store the release tag + tag="${{ github.event.release.tag_name }}" + + # files to search for + md_rst_files=$(find . -type f \( -name "*.md" -o -name "*.rst" \)) + + # regex patterns + badge_pattern="s#(readthedocs\.org/projects/glass/badge/\?version=)stable#\1${tag}#g" + url_pattern="s#(glass\.readthedocs\.io.*?)/stable#\1/${tag}#g" + + # perform the replacements + for file in $md_rst_files; do + sed -E -i "$badge_pattern; $url_pattern" "$file" + done + - name: Build SDist and wheel run: pipx run build