Skip to content
Closed
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
35 changes: 33 additions & 2 deletions .github/release/partial_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
class VersionType(Enum):
MAJOR = (1,)
MINOR = (2,)
PATCH = 3
PATCH = (3,)
SNAPSHOT = (4,)


@click.group(invoke_without_command=False)
Expand All @@ -34,6 +35,27 @@ def main(ctx):
pass


@main.command()
@click.option(
"--artifact-ids",
required=True,
type=str,
help="""
Artifact IDs whose version needs to update, separated by comma.
""",
)
@click.option(
"--versions",
required=False,
default="./versions.txt",
type=str,
help="""
The path to the versions.txt.
""",
)
def bump_snapshot_version(artifact_ids: str, versions: str) -> None:
bump_version(artifact_ids, "snapshot", versions)

@main.command()
@click.option(
"--artifact-ids",
Expand All @@ -49,7 +71,7 @@ def main(ctx):
default="patch",
type=str,
help="""
The type of version bump, one of major, minor or patch.
The type of version bump, one of major, minor, patch.
""",
)
@click.option(
Expand All @@ -62,6 +84,9 @@ def main(ctx):
""",
)
def bump_released_version(artifact_ids: str, version_type: str, versions: str) -> None:
bump_version(artifact_ids, version_type, versions)

def bump_version(artifact_ids: str, version_type: str, versions: str) -> None:
target_artifact_ids = set(artifact_ids.split(","))
version_enum = _parse_type_or_raise(version_type)
newlines = []
Expand Down Expand Up @@ -95,6 +120,12 @@ def bump_released_version(artifact_ids: str, version_type: str, versions: str) -
minor += 1
case VersionType.PATCH:
patch += 1
case VersionType.SNAPSHOT:
# Keep the released version as is.
newlines.append(
f"{artifact_id}:{major}.{minor}.{patch}:{major}.{minor + 1}.0-SNAPSHOT"
)
continue
newlines.append(
f"{artifact_id}:{major}.{minor}.{patch}:{major}.{minor}.{patch}"
)
Expand Down
Loading
Loading