This commit is contained in:
jerger 2023-02-24 10:14:26 +01:00
parent 4f499bd1f4
commit 74925a90b7
7 changed files with 33 additions and 20 deletions

View file

@ -1,5 +1,12 @@
from release_type import ReleaseType
from file_handlers import FileHandler
from enum import Enum
class ReleaseType(Enum):
MAJOR = 0
MINOR = 1
PATCH = 2
SNAPSHOT = 3
BUMP = None
class Version():
@ -19,11 +26,11 @@ class Version():
case ReleaseType.PATCH:
self.version_list[ReleaseType.PATCH.value] += 1
case ReleaseType.MINOR:
self.version_list[ReleaseType.PATCH.value] = 0
self.version_list[ReleaseType.PATCH.value] = 0
self.version_list[ReleaseType.MINOR.value] += 1
case ReleaseType.MAJOR:
self.version_list[ReleaseType.PATCH.value] = 0
self.version_list[ReleaseType.MINOR.value] = 0
self.version_list[ReleaseType.PATCH.value] = 0
self.version_list[ReleaseType.MINOR.value] = 0
self.version_list[ReleaseType.MAJOR.value] += 1
case None:
raise Exception("Release Type was not set!")
@ -45,3 +52,9 @@ class Version():
bump_version.is_snapshot = self.is_snapshot
bump_version.increment(ReleaseType.BUMP)
return bump_version
class Release():
def __init__(self, release_type: ReleaseType, version: Version):
self.release_type = release_type
self.version = version

View file

@ -2,7 +2,7 @@ import os
import subprocess as sub
from pathlib import Path
from system_repository import SystemRepository
from release_type import ReleaseType
from domain import ReleaseType
class GitRepository():

8
infrastructure.py Normal file
View file

@ -0,0 +1,8 @@
from domain import Release
class ReleaseRepository():
def __init__(self):
pass
def get_current_release(self) -> Release:
pass

View file

@ -2,11 +2,10 @@ import copy
from ddadevops import DevopsBuild
from ddadevops import execute
from ddadevops import gopass_field_from_path, gopass_password_from_path
from version import Version
from version_repository import VersionRepository
from services import InitReleaseService, PrepareReleaseService, TagAndPushReleaseService
from git_repository import GitRepository
from release_type import ReleaseType
from domain import ReleaseType, Version
def create_release_mixin_config(config_file, main_branch) -> dict:
config = {}

View file

@ -1,7 +0,0 @@
from enum import Enum
class ReleaseType(Enum):
MAJOR = 0
MINOR = 1
PATCH = 2
SNAPSHOT = 3
BUMP = None

View file

@ -2,7 +2,7 @@ from pathlib import Path
from version_repository import VersionRepository
from release_type import ReleaseType
from git_repository import GitRepository
from version import Version
from domain import Version
class InitReleaseService():

View file

@ -1,5 +1,5 @@
from file_handlers import FileHandler
from version import Version
from domain import Version
class VersionRepository():