From 9eacd02458cfa0d404bfeb766aa30a1b597f460a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Pi=C3=B1a?= Date: Tue, 18 Jun 2024 17:32:22 -0500 Subject: [PATCH] update bump --- CHANGELOG.md | 4 ++++ changelog.lock | 10 +++++++++- scripts/__init__.py | 3 +-- scripts/bump.py | 34 +++++++++++++++++++--------------- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20d661b..2794759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- get version + ## [1.0.5] - 2023-11-12 ### Security diff --git a/changelog.lock b/changelog.lock index b66c7ab..c11da12 100644 --- a/changelog.lock +++ b/changelog.lock @@ -2,7 +2,15 @@ "repository": "https://github.com/sauljabin/changeloggh", "versions": [ { - "version": "Unreleased" + "version": "Unreleased", + "changes": [ + { + "type": "Fixed", + "entries": [ + "get version" + ] + } + ] }, { "version": "1.0.5", diff --git a/scripts/__init__.py b/scripts/__init__.py index dc85d27..f7fdb3b 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -19,11 +19,10 @@ def run(self): command_split = shlex.split(command) result = subprocess.run(command_split) if result.returncode: - console.print( + raise Exception( f"\n[bold red]Error:exclamation:[/] in [bold blue]{name} ([bold" f" yellow]{command}[/])[/]" ) - sys.exit(result.returncode) if __name__ == "__main__": diff --git a/scripts/bump.py b/scripts/bump.py index 0a24534..58451bf 100644 --- a/scripts/bump.py +++ b/scripts/bump.py @@ -21,27 +21,31 @@ def main(rule): More info at https://python-poetry.org/docs/cli/#version and https://semver.org/. """ + console = Console() - bump_version(rule) - new_app_version = get_app_version() - changelog_release(new_app_version) + try: + bump_version(rule) + new_app_version = get_app_version() - console = Console() - confirmation = console.input( - f"Release a new [purple bold]{rule}[/] version [bold purple]{new_app_version}[/] ([bold" - " green]yes[/]/[bold red]no[/])? " - ) + changelog_release(new_app_version) + + confirmation = console.input( + f"Release a new [purple bold]{rule}[/] version [bold purple]{new_app_version}[/] ([bold" + " green]yes[/]/[bold red]no[/])? " + ) - if confirmation != "yes": - revert_changes() - exit(1) + if confirmation != "yes": + revert_changes() + exit(1) - confirm_changes(new_app_version) + confirm_changes(new_app_version) + except Exception as e: + console.print(str(e)) def changelog_release(version): init_commands = { - f"bumping changelog to a [purple bold]{version}[/] version": ( + f"updating changelog to a [purple bold]{version}[/] version": ( f"poetry run changeloggh release {version}" ), } @@ -54,7 +58,7 @@ def bump_version(rule): "checking pending changes": "git diff --exit-code", "checking pending changes in stage": "git diff --staged --exit-code", "checking not pushed commits": "git diff --exit-code main origin/main", - f"bumping to a [purple bold]{rule}[/] version": f"poetry version {rule}", + f"updating to a [purple bold]{rule}[/] version": f"poetry version {rule}", } command_processor = CommandProcessor(init_commands) command_processor.run() @@ -63,7 +67,7 @@ def bump_version(rule): def confirm_changes(app_version): confirm_commands = { "adding new version": "git add --all", - "committing new version": f"git commit -m 'bumping version to {app_version}'", + "committing new version": f"git commit -m 'updating version to {app_version}'", "adding new version tag": f"git tag v{app_version}", "pushing new changes": "git push origin main", "pushing tag": "git push --tags",