Implement and use TagAndPushReleaseService
This commit is contained in:
parent
e7152301dd
commit
4a23b0b800
2 changed files with 13 additions and 14 deletions
|
@ -49,16 +49,6 @@ class ReleaseMixin(DevopsBuild):
|
|||
prepare_release_service.write_and_commit_release(self.release_version)
|
||||
prepare_release_service.write_and_commit_bump(self.bump_version)
|
||||
|
||||
def tag_and_push(self, version):
|
||||
git_repository = GitRepository()
|
||||
match version.release_type:
|
||||
case None:
|
||||
raise Exception('Release type not set but trying to tag and push.')
|
||||
case ReleaseType.BUMP:
|
||||
annotation = 'v' + version.get_version_string()
|
||||
message = 'Version bump'
|
||||
case _:
|
||||
annotation = 'v' + self.release_version.get_version_string()
|
||||
message = 'Release' + annotation
|
||||
git_repository.tag_annotated(annotation, message)
|
||||
git_repository.push()
|
||||
def tag_and_push(self):
|
||||
tag_and_push_release_service = TagAndPushReleaseService(self.git_repo)
|
||||
tag_and_push_release_service.tag_and_push_release(self.release_version)
|
||||
|
|
11
services.py
11
services.py
|
@ -56,5 +56,14 @@ class PrepareReleaseService():
|
|||
self.__write_and_commit_version(bump_version, commit_message=f'Version bump')
|
||||
|
||||
class TagAndPushReleaseService():
|
||||
pass
|
||||
|
||||
def __init__(self, git_repository: GitRepository):
|
||||
self.git_repository = git_repository
|
||||
|
||||
def tag_and_push_release(self, release_version: Version):
|
||||
annotation = 'v' + release_version.get_version_string()
|
||||
message = 'Release ' + annotation
|
||||
self.git_repository.tag_annotated(annotation, message, 1)
|
||||
self.git_repository.push()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue