add update release_type

This commit is contained in:
Michael Jerger 2023-06-26 09:36:00 +02:00
parent cd52a009f3
commit 2ef93a5972
3 changed files with 10 additions and 1 deletions

View file

@ -5,6 +5,7 @@ Support for releases following the trunk-based-release flow (see https://trunkba
```mermaid ```mermaid
classDiagram classDiagram
class ReleaseMixin { class ReleaseMixin {
update_release_type (release_type) - change the release type during run time
prepare_release() - adjust all build files to carry the correct version & commit localy prepare_release() - adjust all build files to carry the correct version & commit localy
tag_and_push_release() - tag the git repo and push changes to origin tag_and_push_release() - tag the git repo and push changes to origin
} }

View file

@ -22,6 +22,9 @@ class Release(Validateable):
) )
self.version = version self.version = version
def update_release_type(self, release_type: ReleaseType):
self.release_type = release_type
def validate(self): def validate(self):
result = [] result = []
result += self.__validate_is_not_empty__("release_type") result += self.__validate_is_not_empty__("release_type")

View file

@ -1,7 +1,7 @@
from pybuilder.core import Project from pybuilder.core import Project
from .devops_build import DevopsBuild from .devops_build import DevopsBuild
from .application import ReleaseService from .application import ReleaseService
from .domain import MixinType from .domain import MixinType, ReleaseType
class ReleaseMixin(DevopsBuild): class ReleaseMixin(DevopsBuild):
@ -12,6 +12,11 @@ class ReleaseMixin(DevopsBuild):
if MixinType.RELEASE not in devops.mixins: if MixinType.RELEASE not in devops.mixins:
raise ValueError("ReleaseMixin requires MixinType.RELEASE") raise ValueError("ReleaseMixin requires MixinType.RELEASE")
def update_release_type(self, release_type: ReleaseType):
devops = self.devops_repo.get_devops(self.project)
release = devops.mixins[MixinType.RELEASE]
release.update_release_type(release_type)
def prepare_release(self): def prepare_release(self):
devops = self.devops_repo.get_devops(self.project) devops = self.devops_repo.get_devops(self.project)
release = devops.mixins[MixinType.RELEASE] release = devops.mixins[MixinType.RELEASE]