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_release(self.release_version)
|
||||||
prepare_release_service.write_and_commit_bump(self.bump_version)
|
prepare_release_service.write_and_commit_bump(self.bump_version)
|
||||||
|
|
||||||
def tag_and_push(self, version):
|
def tag_and_push(self):
|
||||||
git_repository = GitRepository()
|
tag_and_push_release_service = TagAndPushReleaseService(self.git_repo)
|
||||||
match version.release_type:
|
tag_and_push_release_service.tag_and_push_release(self.release_version)
|
||||||
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()
|
|
||||||
|
|
11
services.py
11
services.py
|
@ -56,5 +56,14 @@ class PrepareReleaseService():
|
||||||
self.__write_and_commit_version(bump_version, commit_message=f'Version bump')
|
self.__write_and_commit_version(bump_version, commit_message=f'Version bump')
|
||||||
|
|
||||||
class TagAndPushReleaseService():
|
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