Skip to content

Commit

Permalink
fix: bugs that the latest tag is not parsed (#330)
Browse files Browse the repository at this point in the history
bug: fix bugs that the latest tag is not parsed

Signed-off-by: Junya Sasaki <[email protected]>
  • Loading branch information
sasakisasaki authored Dec 20, 2024
1 parent f959598 commit f33a673
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,27 +204,27 @@ def get_latest_tag(tags: list[str], current_version: str, target_release: str) -
if target_release == 'major':
if parsed_tag.major > current_ver.major:
# Only consider tags with a higher major version
if latest_tag is None or parsed_tag < version.parse(latest_tag):
if latest_tag is None or parsed_tag > version.parse(latest_tag):
latest_tag = tag

elif target_release == 'minor':
if parsed_tag.major == current_ver.major and parsed_tag.minor > current_ver.minor:
# Only consider tags with the same major but higher minor version
if latest_tag is None or parsed_tag < version.parse(latest_tag):
if latest_tag is None or parsed_tag > version.parse(latest_tag):
latest_tag = tag

elif target_release == 'patch':
if (parsed_tag.major == current_ver.major and
parsed_tag.minor == current_ver.minor and
parsed_tag.micro > current_ver.micro):
# Only consider tags with the same major and minor but higher patch version
if latest_tag is None or parsed_tag < version.parse(latest_tag):
if latest_tag is None or parsed_tag > version.parse(latest_tag):
latest_tag = tag

elif target_release == 'any':
# Consider any version newer than the current version
if parsed_tag > current_ver:
if latest_tag is None or parsed_tag < version.parse(latest_tag):
if latest_tag is None or parsed_tag > version.parse(latest_tag):
latest_tag = tag

return latest_tag
Expand Down

0 comments on commit f33a673

Please sign in to comment.