Implement bump release

This commit is contained in:
erik 2023-02-20 16:21:02 +01:00
parent fa7e10d3ce
commit c137344932
2 changed files with 15 additions and 8 deletions

View file

@ -31,7 +31,7 @@ class InitReleaseService():
raise Exception('VersionRepo was not created. Did you run create_lease_version()?') raise Exception('VersionRepo was not created. Did you run create_lease_version()?')
version_list = self.get_version_list() version_list = self.get_version_list()
bump_version = Version.create_bump_version(version_list, ReleaseType.SNAPSHOT) bump_version = Version.create_bump_version(version_list)
self.version_repo.write_file(bump_version.get_version_string()) self.version_repo.write_file(bump_version.get_version_string())

View file

@ -19,6 +19,7 @@ class ReleaseType(Enum):
MINOR = 1 MINOR = 1
PATCH = 2 PATCH = 2
SNAPSHOT = 3 SNAPSHOT = 3
BUMP = None
class Version(): class Version():
@ -30,6 +31,9 @@ class Version():
def increment(self, release_type: ReleaseType): def increment(self, release_type: ReleaseType):
self.is_snapshot = False self.is_snapshot = False
match release_type: match release_type:
case ReleaseType.BUMP:
self.is_snapshot = True
self.version_list[ReleaseType.PATCH.value] += 1
case ReleaseType.SNAPSHOT: case ReleaseType.SNAPSHOT:
self.is_snapshot = True self.is_snapshot = True
case ReleaseType.PATCH: case ReleaseType.PATCH:
@ -50,11 +54,14 @@ class Version():
@classmethod @classmethod
def create_release_version(cls, version_list, release_type): def create_release_version(cls, version_list, release_type):
inst = cls(version_list, release_type) inst = cls(version_list, release_type)
inst.increment(release_type) if release_type == ReleaseType.PATCH:
inst.is_snapshot = False
else:
inst.increment(release_type)
return inst return inst
@classmethod @classmethod
def create_bump_version(cls, version_list, release_type): def create_bump_version(cls, version_list):
pass inst = cls(version_list, ReleaseType.BUMP)
inst.increment(release_type)
return inst