mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
Include tag distance and commit hash in dev versions when possible (#5664)
* Include tag distance and commit hash in dev versions when possible * Fix test
This commit is contained in:
7
.github/workflows/scripts/bump_version.py
vendored
7
.github/workflows/scripts/bump_version.py
vendored
@@ -4,10 +4,11 @@ import sys
|
||||
from typing import Match
|
||||
|
||||
import redbot
|
||||
from redbot._version import __version__
|
||||
|
||||
|
||||
if int(os.environ.get("JUST_RETURN_VERSION", 0)):
|
||||
print(f"::set-output name=version::{redbot.__version__}")
|
||||
print(f"::set-output name=version::{__version__}")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -33,7 +34,7 @@ def repl(match: Match[str]) -> str:
|
||||
return f'__version__ = "{version_info}"'
|
||||
|
||||
|
||||
with open("redbot/__init__.py", encoding="utf-8") as fp:
|
||||
with open("redbot/_version.py", encoding="utf-8") as fp:
|
||||
new_contents, found = re.subn(
|
||||
pattern=r'^__version__ = "(?P<version>[^"]*)"$',
|
||||
repl=repl,
|
||||
@@ -46,7 +47,7 @@ if not found:
|
||||
print("Couldn't find `__version__` line!")
|
||||
sys.exit(1)
|
||||
|
||||
with open("redbot/__init__.py", "w", encoding="utf-8", newline="\n") as fp:
|
||||
with open("redbot/_version.py", "w", encoding="utf-8", newline="\n") as fp:
|
||||
fp.write(new_contents)
|
||||
|
||||
print(f"::set-output name=new_version::{version_info}")
|
||||
|
||||
Reference in New Issue
Block a user