Improved build version stuff

This commit is contained in:
Sven Heidemann 2022-11-18 09:30:29 +01:00
parent 8445c23e7f
commit 47dd6fdc2d
2 changed files with 11 additions and 6 deletions

View File

@ -19,7 +19,7 @@
"set-version": "tools/set_version/set-version.json"
},
"Scripts": {
"sv": "cpl set-version",
"sv": "cpl set-version $ARGS",
"set-version": "cpl run set-version $ARGS; echo '';",
"gv": "cpl get-version",
@ -37,9 +37,10 @@
"pre-dev": "cpl build",
"dev": "export KDB_ENVIRONMENT=development; export KDB_NAME=KDB-Dev; cpl start;",
"docker-build": "cpl b; docker-compose down; docker build -t kdb-bot/kdb-bot:$(cpl gv) .",
"docker-compose": "docker-compose up -d",
"docker": "cpl docker-build; cpl docker-compose;"
"docker-build": "cpl build $ARGS; cd docker; echo docker build -t kdb-bot/kdb-bot:$(cd ../; cpl gv; cd docker;) .; cd ..;",
"dc-up": "docker-compose up -d",
"dc-down": "docker-compose down",
"docker": "cpl dc-down; cpl docker-build; cpl dc-up;"
}
}
}

View File

@ -46,7 +46,7 @@ class Application(ApplicationABC):
return
if len(args) == 1:
suffix = f'.{args[0]}'
suffix = args[0]
try:
branch = self._git_service.get_active_branch_name()
@ -67,8 +67,12 @@ class Application(ApplicationABC):
version[VersionSettingsNameEnum.major.value] = branch.split('.')[0]
version[VersionSettingsNameEnum.minor.value] = branch.split('.')[1]
if len(branch.split('.')) == 2:
version[VersionSettingsNameEnum.micro.value] = f'0{suffix}'
if suffix == '':
suffix = '0'
version[VersionSettingsNameEnum.micro.value] = f'{suffix}'
else:
if not suffix.startswith('.') and suffix != '':
suffix = f'.{suffix}'
version[VersionSettingsNameEnum.micro.value] = f'{branch.split(".")[2]}{suffix}'
except Exception as e:
Console.error(f'Branch {branch} does not contain valid version')