Packaging: fix status badges in frozen readme

GitHub status badge urls no longer allow
branch=TAG. Must use branch=BRANCH or
tag=TAG. (This was only visible in
published description on PyPI.)

(Actions job filter still requires branch=TAG_OR_BRANCH)
This commit is contained in:
Mike Edmunds
2023-12-04 11:33:44 -08:00
parent c147754c4c
commit 3a89bb9b38

View File

@@ -12,10 +12,16 @@ def freeze_readme_versions(text: str, version: str) -> str:
(This assumes version X.Y will be tagged "vX.Y" in git.) (This assumes version X.Y will be tagged "vX.Y" in git.)
""" """
release_tag = f"v{version}" release_tag = f"v{version}"
return re.sub(
# (?<=...) is "positive lookbehind": must be there, but won't get replaced # (?<=...) is "positive lookbehind": must be there, but won't get replaced
# GitHub Actions build status: branch=main --> branch=vX.Y.Z: text = re.sub(
r"(?<=branch[=:])main" # GitHub Actions badge: badge.svg?branch=main --> badge.svg?tag=vX.Y.Z:
r"(?<=badge\.svg\?)branch=main",
f"tag={release_tag}",
text,
)
return re.sub(
# GitHub Actions status links: branch:main --> branch:vX.Y.Z:
r"(?<=branch:)main"
# ReadTheDocs links: /stable --> /vX.Y.Z: # ReadTheDocs links: /stable --> /vX.Y.Z:
r"|(?<=/)stable" r"|(?<=/)stable"
# ReadTheDocs badge: version=stable --> version=vX.Y.Z: # ReadTheDocs badge: version=stable --> version=vX.Y.Z: