From 3fe430c12cc47119c985c5d5477bac8b34505e08 Mon Sep 17 00:00:00 2001 From: tandemdude <43570299+tandemdude@users.noreply.github.com> Date: Wed, 1 May 2024 10:27:36 +0100 Subject: [PATCH] Update version to use alpha instead of dev --- .github/workflows/deploy.yml | 2 +- lightbulb/__init__.py | 2 +- scripts/deploy/update_version.py | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d0c3233e..e9d41b1f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,7 @@ on: - major - minor - patch - - dev + - alpha increment: description: "Whether to increment the version before release." type: boolean diff --git a/lightbulb/__init__.py b/lightbulb/__init__.py index 6131fedb..4b49f2fc 100644 --- a/lightbulb/__init__.py +++ b/lightbulb/__init__.py @@ -71,4 +71,4 @@ ] # Do not change the below field manually. It is updated by CI upon release. -__version__ = "3.0.0.dev0" +__version__ = "3.0.0a0" diff --git a/scripts/deploy/update_version.py b/scripts/deploy/update_version.py index 670f1f06..0fa70366 100644 --- a/scripts/deploy/update_version.py +++ b/scripts/deploy/update_version.py @@ -22,10 +22,10 @@ import re import sys -VERSION_REGEX = re.compile(r"__version__\s*=\s*\"(?P\d+\.\d+\.\d+)(?:\.dev(?P\d+))?\"") +VERSION_REGEX = re.compile(r"__version__\s*=\s*\"(?P\d+\.\d+\.\d+)(?:a(?P\d+))?\"") parser = argparse.ArgumentParser() -parser.add_argument("type", choices=["major", "minor", "patch", "dev"]) +parser.add_argument("type", choices=["major", "minor", "patch", "alpha"]) parser.add_argument("increment") _noop = lambda n: n # noqa: E731 @@ -36,7 +36,7 @@ "major": (_increment, _reset, _reset, _reset), "minor": (_noop, _increment, _reset, _reset), "patch": (_noop, _noop, _increment, _reset), - "dev": (_noop, _noop, _noop, _increment), + "alpha": (_noop, _noop, _noop, _increment), } @@ -49,21 +49,21 @@ def run(version_type: str, increment: str) -> None: raise RuntimeError("Could not find version in __init__ file") version = current_version.groupdict()["version"] - dev = current_version.groupdict().get("devnum", "0") + alpha = current_version.groupdict().get("alphanum", "0") if increment.lower() != "true": - sys.stdout.write(f"{version}{('.dev' + dev) if version_type.lower() == 'dev' else ''}") + sys.stdout.write(f"{version}{('a' + alpha) if version_type.lower() == 'alpha' else ''}") return major, minor, patch = version.split(".") actions = ACTIONS[version_type.lower()] - major, minor, patch, dev = [a(s) for a, s in zip(actions, [major, minor, patch, dev])] + major, minor, patch, alpha = [a(s) for a, s in zip(actions, [major, minor, patch, alpha])] new_version = f"{major}.{minor}.{patch}" - if version_type.lower() == "dev": - new_version += f".dev{dev}" + if version_type.lower() == "alpha": + new_version += f"a{alpha}" updated_file_content = VERSION_REGEX.sub(f'__version__ = "{new_version}"', content) with open("lightbulb/__init__.py", "w") as fp: