Compare commits
4 commits
3661e47bff
...
7eb7a2647a
Author | SHA1 | Date | |
---|---|---|---|
7eb7a2647a | |||
38c7aa97ca | |||
22c5f6777e | |||
e68ae46804 |
4 changed files with 87 additions and 33 deletions
39
build.py
39
build.py
|
@ -1,7 +1,13 @@
|
|||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
from version import *
|
||||
from release_mixin import *
|
||||
|
||||
CONFIG_FILE = ''
|
||||
COMMIT_ID = ''
|
||||
|
||||
class MyBuild(ReleaseMixin):
|
||||
pass
|
||||
|
||||
def main():
|
||||
init_project()
|
||||
|
@ -9,23 +15,24 @@ def main():
|
|||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on('ddadevops>=3.1.2')
|
||||
# build = get_devops_build()
|
||||
# build.init()
|
||||
init_project()
|
||||
|
||||
if COMMIT_ID == '':
|
||||
COMMIT_ID = 'HEAD'
|
||||
|
||||
config = create_release_mixin_config(CONFIG_FILE, COMMIT_ID)
|
||||
|
||||
build = MyBuild(project, config)
|
||||
|
||||
build.init()
|
||||
|
||||
|
||||
@task
|
||||
def release(project):
|
||||
# build = get_devops_build(project)
|
||||
# build.prepare_release() # mit config file
|
||||
prepare_release()
|
||||
# build()
|
||||
# build.publish()
|
||||
# build.release_in_git()
|
||||
# release_in_git()
|
||||
|
||||
@task
|
||||
def build(project):
|
||||
def prepare(project):
|
||||
build = get_devops_build(project)
|
||||
# ToDo: Implement for project
|
||||
build.prepare_release()
|
||||
|
||||
main()
|
||||
@task
|
||||
def tag_and_push(project):
|
||||
build = get_devops_build(project)
|
||||
build.tag_and_push()
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@ from ddadevops import gopass_field_from_path, gopass_password_from_path
|
|||
from version import Version
|
||||
|
||||
|
||||
def add_release_mixin_config(config, release_type, commit, file):
|
||||
def create_release_mixin_config(config, release_type, commit, file):
|
||||
config.update({'ReleaseMixin':
|
||||
{'release_type': release_type,
|
||||
'commit': commit,
|
||||
{'commit_id': commit,
|
||||
'file': file}})
|
||||
return config
|
||||
|
||||
|
@ -17,26 +16,18 @@ class ReleaseMixin(DevopsBuild):
|
|||
|
||||
def __init__(self, project, config):
|
||||
super().__init__(project, config)
|
||||
release_mixin_config = config['ReleaseMixin']
|
||||
self.release_type = release_mixin_config['release_type4']
|
||||
self.commit = release_mixin_config['commit']
|
||||
release_mixin_config = config['ReleaseMixin']
|
||||
self.commit_id = release_mixin_config['commit_id']
|
||||
self.file = release_mixin_config['file']
|
||||
|
||||
def read_commit_message(self):
|
||||
pass
|
||||
def init(self):
|
||||
release_and_bump_version = InitReleaseService(self.commit_id, self.file).get_version()
|
||||
return release_and_bump_version
|
||||
|
||||
def calculate_release_type(self):
|
||||
pass
|
||||
|
||||
def get_version(self):
|
||||
|
||||
return Version.from_file(self.file)
|
||||
|
||||
def create_release_version(self):
|
||||
pass
|
||||
|
||||
def create_bump_version(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
39
services.py
Normal file
39
services.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
class InitReleaseService():
|
||||
|
||||
def __init__(self, commit_id, file):
|
||||
self.commit_id = commit_id
|
||||
self.file = file
|
||||
|
||||
def __read_commit_message(self):
|
||||
pass
|
||||
|
||||
def __calculate_release_type(self):
|
||||
pass
|
||||
|
||||
def get_version(self):
|
||||
|
||||
current_version = VersionRepository.get_current_version(self.file)
|
||||
commit_message = self.read_commit_message(self.commit_id)
|
||||
release_type = self.calculate_release_type(commit_message)
|
||||
|
||||
release_version = create_release_version(current_version,release_type)
|
||||
bump_version = create_bump_version(current_version,release_type)
|
||||
|
||||
release_and_bump_version = tuple(release_version, bump_version)
|
||||
|
||||
return release_and_bump_version
|
||||
|
||||
def create_release_version(self):
|
||||
pass
|
||||
|
||||
def create_bump_version(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class PrepareReleaseService():
|
||||
pass
|
||||
|
||||
class TagAndPushReleaseService():
|
||||
pass
|
||||
|
17
version_repository.py
Normal file
17
version_repository.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from file_handlers import FileHandler
|
||||
|
||||
class VersionRepository():
|
||||
|
||||
def __init__(self, file):
|
||||
self.file = file
|
||||
|
||||
@classmethod
|
||||
def load_file(cls, file):
|
||||
file_handler = FileHandler.from_file_path(file)
|
||||
version, is_snapshot = file_handler.parse()
|
||||
inst = cls(version, is_snapshot)
|
||||
inst.file_handler = file_handler
|
||||
|
||||
return inst
|
||||
|
||||
|
Loading…
Reference in a new issue