Compare commits
3 commits
9bde301ee4
...
9c9676b5b8
Author | SHA1 | Date | |
---|---|---|---|
9c9676b5b8 | |||
28344667db | |||
338cafc211 |
2 changed files with 6 additions and 15 deletions
|
@ -31,20 +31,13 @@ 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_version)
|
||||
tag_and_push_release_service.tag_and_push_release(self.release_repo.get_release())
|
||||
|
|
12
services.py
12
services.py
|
@ -1,6 +1,6 @@
|
|||
from pathlib import Path
|
||||
from infrastructure import VersionRepository, ReleaseRepository, GitApi
|
||||
from domain import Version, ReleaseType
|
||||
from domain import Version, ReleaseType, Release
|
||||
|
||||
class PrepareReleaseService():
|
||||
|
||||
|
@ -8,12 +8,10 @@ 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):
|
||||
if self.main_branch != self.git_api.get_current_branch():
|
||||
raise Exception('Trying to release while not on main branch')
|
||||
|
||||
self.release.validate(self.release_repo.main_branch)
|
||||
|
||||
self.release_repo.version_repository.write_file(version.get_version_string())
|
||||
self.git_api.add_file(self.release_repo.version_repository.file)
|
||||
self.git_api.commit(commit_message)
|
||||
|
@ -30,8 +28,8 @@ class TagAndPushReleaseService():
|
|||
def __init__(self, git_api: GitApi):
|
||||
self.git_api = git_api
|
||||
|
||||
def tag_and_push_release(self, release_version: Version):
|
||||
annotation = 'v' + release_version.get_version_string()
|
||||
def tag_and_push_release(self, release: Release):
|
||||
annotation = 'v' + release.version.get_version_string()
|
||||
message = 'Release ' + annotation
|
||||
self.git_api.tag_annotated(annotation, message, 1)
|
||||
# self.git_api.push()
|
||||
|
|
Loading…
Reference in a new issue