Skip to content

feat: enable --prerelease none for CI/CD #1162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commitizen/bump.py
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ def find_increment(
if increment == MAJOR:
break

return cast(Increment, increment)
return None if increment is None else Increment[increment]


def update_version_in_files(
2 changes: 1 addition & 1 deletion commitizen/cli.py
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ def __call__(
{
"name": ["--prerelease", "-pr"],
"help": "choose type of prerelease",
"choices": ["alpha", "beta", "rc"],
"choices": ["alpha", "beta", "rc", "none"],
},
{
"name": ["--devrelease", "-d"],
2 changes: 1 addition & 1 deletion commitizen/commands/bump.py
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ def __call__(self) -> None: # noqa: C901
dry_run: bool = self.arguments["dry_run"]
is_yes: bool = self.arguments["yes"]
increment: Increment | None = self.arguments["increment"]
prerelease: Prerelease | None = self.arguments["prerelease"]
prerelease: Prerelease | None = None if self.arguments["prerelease"] == "none" else self.arguments["prerelease"]
devrelease: int | None = self.arguments["devrelease"]
is_files_only: bool | None = self.arguments["files_only"]
is_local_version: bool = self.arguments["local_version"]
17 changes: 15 additions & 2 deletions commitizen/version_schemes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import enum
import re
import sys
import warnings
@@ -37,11 +38,23 @@
from typing import Self


Increment: TypeAlias = Literal["MAJOR", "MINOR", "PATCH"]
Prerelease: TypeAlias = Literal["alpha", "beta", "rc"]
DEFAULT_VERSION_PARSER = r"v?(?P<version>([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?(\w+)?)"


class Increment(enum.StrEnum):
MAJOR = "MAJOR"
MINOR = "MINOR"
PATCH = "PATCH"


class Prerelease(enum.StrEnum):
alpha = "alpha"
beta = "beta"
rc = "rc"
none = "none"



@runtime_checkable
class VersionProtocol(Protocol):
parser: ClassVar[re.Pattern]