Tool: Version erhöhen

This commit is contained in:
2026-01-09 07:01:37 +01:00
parent 3c17fbf81a
commit 323869869d
2 changed files with 44 additions and 0 deletions

43
src/increment_version.py Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
import yaml
from release import versioning
from release.project import parse_project_description
def main_cli():
parser = ArgumentParser()
parser.add_argument(
'--release-yaml-filename', default='.gitea/release.yaml')
bump_group = parser.add_mutually_exclusive_group()
bump_group.add_argument('--major', action='store_true')
bump_group.add_argument('--minor', action='store_true') # the default
bump_group.add_argument('--patch', action='store_true')
args = parser.parse_args()
with open(args.release_yaml_filename, 'r') as f:
project_description = parse_project_description(
yaml.safe_load(f))
version = versioning.use_any(project_description.version_descriptor)
if args.major:
version.version = version.version.bump_major()
elif args.minor:
version.version = version.version.bump_minor()
elif args.patch:
version.version = version.version.bump_patch()
else:
version.version = version.version.bump_minor()
print(f'incremented version: {version.version}')
version.store()
if __name__ == '__main__':
main_cli()