Skip to content

Commit

Permalink
feat: close #29. use the max of versions as latest version to bump
Browse files Browse the repository at this point in the history
  • Loading branch information
thorwhalen committed Jun 28, 2024
1 parent 66bd7b0 commit 5fd11a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions isee/generation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
DFLT_NEW_VERSION = '0.1.0' # Default version if no tags are found


def get_new_version(*, work_tree='.', version_patch_prefix: str = ''):
def get_new_version(
*,
work_tree='.',
version_patch_prefix: str = '',
action_when_versions_not_valid=warn,
):
"""
Get the latest version from git tags and determine the new version based on
the commit message.
Expand Down Expand Up @@ -65,14 +70,17 @@ def format_version(version):
return '.'.join(version_parts)

versions = versions_from_different_sources(work_tree)
validate_versions(versions)
current_version = versions.get('current_pypi')

if current_version:
validate_versions(versions, action_when_not_valid=action_when_versions_not_valid)

# Take the highest version from the different sources to be the latest version
latest_version = max(filter(None, versions.values()), key=semver.VersionInfo.parse)

if latest_version:
# If there are existing versions, bump the latest version
new_version = bump(current_version)
new_version = bump(latest_version)
else:
# No tags in the repository, use the default version
# No versions found so, use the default version
new_version = DFLT_NEW_VERSION
return format_version(new_version)

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = isee
version = 0.2.19
version = 0.2.20
url = https://github.com/i2mint/isee
platforms = any
description_file = README.md
Expand Down

0 comments on commit 5fd11a6

Please sign in to comment.