Skip to content

Commit

Permalink
update bump
Browse files Browse the repository at this point in the history
  • Loading branch information
sauljabin committed Jun 18, 2024
1 parent 4ff4e2f commit 9eacd02
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion changelog.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
34 changes: 19 additions & 15 deletions scripts/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
),
}
Expand All @@ -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()
Expand All @@ -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",
Expand Down

0 comments on commit 9eacd02

Please sign in to comment.