Skip to content
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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion commitizen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
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
Expand Down Expand Up @@ -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]
Expand Down
Loading