going to merge Release & ReleaseConfig [skip-ci]
This commit is contained in:
parent
84cf82ac57
commit
92081947c5
1 changed files with 7 additions and 6 deletions
|
@ -74,15 +74,18 @@ class ReleaseConfig(Validateable):
|
|||
):
|
||||
self.main_branch = main_branch
|
||||
self.config_file = config_file
|
||||
# TODO: this information may be transient?
|
||||
self.release_version = release_version
|
||||
self.bump_version = bump_version
|
||||
|
||||
self.devops = devops
|
||||
|
||||
class Release():
|
||||
def __init__(self, release_type: ReleaseType | None, version: Version, current_branch: str):
|
||||
class Release(Validateable):
|
||||
def __init__(self, release_type: ReleaseType | None, version: Version, current_branch: str, main_branch: str):
|
||||
self.release_type = release_type
|
||||
self.version = version
|
||||
self.current_branch = current_branch
|
||||
self.main_branch = main_branch
|
||||
|
||||
def release_version(self):
|
||||
return self.version.create_release_version(self.release_type)
|
||||
|
@ -90,11 +93,9 @@ class Release():
|
|||
def bump_version(self):
|
||||
return self.release_version().create_bump_version()
|
||||
|
||||
def validate(self, main_branch):
|
||||
def validate(self):
|
||||
result = []
|
||||
if self.release_type is not None and main_branch != self.current_branch:
|
||||
if self.release_type is not None and self.main_branch != self.current_branch:
|
||||
result.append(f"Releases are allowed only on {main_branch}")
|
||||
return result
|
||||
|
||||
def is_valid(self, main_branch):
|
||||
return len(self.validate(main_branch)) < 1 # TODO: Use abstract is_valid in Validatable
|
||||
|
|
Loading…
Reference in a new issue