Tool: Version erhöhen
This commit is contained in:
@@ -14,3 +14,4 @@ dependencies = [
|
|||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
gitea-release-action = "main:main_cli"
|
gitea-release-action = "main:main_cli"
|
||||||
|
increment-version = "increment_version:main_cli"
|
||||||
|
|||||||
43
src/increment_version.py
Executable file
43
src/increment_version.py
Executable 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()
|
||||||
Reference in New Issue
Block a user