Compare commits

..

No commits in common. "9c9676b5b84303a0809faa6a77735c4a0d040205" and "9bde301ee404fbfeabac61fcd691064b2dcb06af" have entirely different histories.

2 changed files with 15 additions and 6 deletions

View file

@ -31,13 +31,20 @@ class ReleaseMixin(DevopsBuild):
self.release_type_repo = ReleaseTypeRepository(self.git_api)
self.version_repo = VersionRepository(self.config_file)
self.release_repo = ReleaseRepository(self.version_repo, self.release_type_repo, self.main_branch)
self.release_version = None
self.bump_version = None
self.commit_string = None
def prepare_release(self):
prepare_release_service = PrepareReleaseService(self.release_repo)
if self.release_version is None or self.bump_version is None:
raise Exception('prepare_release was called before init_release')
# prepare_release_service.run_tests() # not implemented
prepare_release_service.write_and_commit_release()
prepare_release_service.write_and_commit_bump()
def tag_and_push_release(self):
tag_and_push_release_service = TagAndPushReleaseService(self.git_api)
tag_and_push_release_service.tag_and_push_release(self.release_repo.get_release())
tag_and_push_release_service.tag_and_push_release(self.release_version)

View file

@ -1,6 +1,6 @@
from pathlib import Path
from infrastructure import VersionRepository, ReleaseRepository, GitApi
from domain import Version, ReleaseType, Release
from domain import Version, ReleaseType
class PrepareReleaseService():
@ -8,9 +8,11 @@ class PrepareReleaseService():
self.release_repo = release_repo
self.release = release_repo.get_release()
self.git_api = GitApi()
self.main_branch = None
def __write_and_commit_version(self, version: Version, commit_message: str):
self.release.validate(self.release_repo.main_branch)
if self.main_branch != self.git_api.get_current_branch():
raise Exception('Trying to release while not on main branch')
self.release_repo.version_repository.write_file(version.get_version_string())
self.git_api.add_file(self.release_repo.version_repository.file)
@ -28,8 +30,8 @@ class TagAndPushReleaseService():
def __init__(self, git_api: GitApi):
self.git_api = git_api
def tag_and_push_release(self, release: Release):
annotation = 'v' + release.version.get_version_string()
def tag_and_push_release(self, release_version: Version):
annotation = 'v' + release_version.get_version_string()
message = 'Release ' + annotation
self.git_api.tag_annotated(annotation, message, 1)
# self.git_api.push()