Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugs that the latest tag is not parsed #330

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading