From 4f3675267957ea52921a936c777b57f78fc07fb1 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 12 Sep 2024 23:16:57 +0300 Subject: [PATCH 1/2] ci: make bump optional --- apps_ci/scripts/bump_version.py | 7 ++++--- apps_ci/version_bump.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps_ci/scripts/bump_version.py b/apps_ci/scripts/bump_version.py index 88a4317..554f4eb 100644 --- a/apps_ci/scripts/bump_version.py +++ b/apps_ci/scripts/bump_version.py @@ -24,11 +24,12 @@ def update_app_version(app_path: str, bump_type: str, dep_name: str, dep_version with open(str(app_metadata_file), 'r') as f: app_config = yaml.safe_load(f.read()) - old_version = app_config['version'] - app_config['version'] = bump_version(old_version, bump_type) if dep_name and dep_version and is_main_dep(app_dir, dep_name): app_config['app_version'] = dep_version - rename_versioned_dir(old_version, app_config['version'], app_dir.parent.name, app_dir) + if bump_type: + old_version = app_config['version'] + app_config['version'] = bump_version(old_version, bump_type) + rename_versioned_dir(old_version, app_config['version'], app_dir.parent.name, app_dir) with open(str(app_metadata_file), 'w') as f: f.write(yaml.safe_dump(app_config)) diff --git a/apps_ci/version_bump.py b/apps_ci/version_bump.py index d2d2531..b4f1ee8 100644 --- a/apps_ci/version_bump.py +++ b/apps_ci/version_bump.py @@ -4,7 +4,7 @@ def map_renovate_bump_type(bump: str) -> str: - return bump if bump in ('patch', 'minor', 'major') else 'patch' + return bump if bump in ('patch', 'minor', 'major', '') else 'patch' def is_valid_version(version: str) -> bool: From c908c41ff61e236904fcaecf9f68deed92d0b211 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Thu, 12 Sep 2024 23:24:49 +0300 Subject: [PATCH 2/2] update message --- apps_ci/scripts/bump_version.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps_ci/scripts/bump_version.py b/apps_ci/scripts/bump_version.py index 554f4eb..f668c0d 100644 --- a/apps_ci/scripts/bump_version.py +++ b/apps_ci/scripts/bump_version.py @@ -24,19 +24,20 @@ def update_app_version(app_path: str, bump_type: str, dep_name: str, dep_version with open(str(app_metadata_file), 'r') as f: app_config = yaml.safe_load(f.read()) + msg = '' if dep_name and dep_version and is_main_dep(app_dir, dep_name): app_config['app_version'] = dep_version + msg += f', set app_version to {dep_version!r}' if bump_type: old_version = app_config['version'] app_config['version'] = bump_version(old_version, bump_type) rename_versioned_dir(old_version, app_config['version'], app_dir.parent.name, app_dir) + msg += f' and bumped version from {old_version!r} to {app_config["version"]!r}' with open(str(app_metadata_file), 'w') as f: f.write(yaml.safe_dump(app_config)) - print( - f'[\033[92mOK\x1B[0m]\tUpdated app {app_dir.name!r} version from {old_version!r} to {app_config["version"]!r}' - ) + print(f'[\033[92mOK\x1B[0m]\tUpdated app {app_dir.name!r}' + msg) def main():