Skip to content

Commit

Permalink
Merge pull request #50 from truenas/ci-optional-bump
Browse files Browse the repository at this point in the history
ci: make bump optional
  • Loading branch information
stavros-k authored Sep 12, 2024
2 parents ff7559e + c908c41 commit 5fa4df4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions apps_ci/scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +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())

old_version = app_config['version']
app_config['version'] = bump_version(old_version, bump_type)
msg = ''
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)
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():
Expand Down
2 changes: 1 addition & 1 deletion apps_ci/version_bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5fa4df4

Please sign in to comment.