Tool: increment-version #2
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "gitea-release-action"
|
name = "gitea-release-action"
|
||||||
version = "0.0.1"
|
version = "0.1.0"
|
||||||
description = "reusable action for release workflows"
|
description = "reusable action for release workflows"
|
||||||
authors = [ ]
|
authors = [ ]
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
@@ -14,3 +14,5 @@ dependencies = [
|
|||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
gitea-release-action = "main:main_cli"
|
gitea-release-action = "main:main_cli"
|
||||||
|
increment-version = "increment_version:main_cli"
|
||||||
|
tell-version = "tell_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()
|
||||||
27
src/tell_version.py
Executable file
27
src/tell_version.py
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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')
|
||||||
|
|
||||||
|
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)
|
||||||
|
print(version.version)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main_cli()
|
||||||
Reference in New Issue
Block a user
Dumme Frage: Warum kann man das nicht einfach direkt über ein vsh-Plugin abbilden?
Weil man dann einen Kontext braucht oder? also
vsh live ...odervsh testing ...Gut ich könnte das schon als Plugin für nen Shell-Kontext machen aber dann müsste man das ja in jedem Projekt konfigurieren...
Oder fändest du das schöner?