Skip to content

Commit

Permalink
fix(algorithm): handle multiple prerelease token variants properly
Browse files Browse the repository at this point in the history
In the case where there are alpha and beta releases, we must only
consider the previous beta release even if alpha releases exist
due to merging into beta release only branches which have no changes
considerable changes from alphas but must be marked otherwise.

Resolves: python-semantic-release#789
  • Loading branch information
codejedi365 committed Apr 20, 2024
1 parent ba3e326 commit 6363525
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion semantic_release/version/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ def next_version(
# bump to produce. However if we're doing a prerelease, we can
# include prereleases here to potentially consider a smaller portion
# of history (from a prerelease since the last full release, onwards)
# Since there are different types of prereleases, only consider the
# prereleases that have the same prerelease token as the current branch's
# translator configuration.

# Note that a side-effect of this is, if at some point the configuration
# for a particular branch pattern changes w.r.t. prerelease=True/False,
Expand All @@ -391,7 +394,10 @@ def next_version(
tag_sha_2_version_lookup = {
tag.commit.hexsha: (tag, version)
for tag, version in all_git_tags_as_versions
if prerelease or not version.is_prerelease
if (
(prerelease and version.prerelease_token == translator.prerelease_token)
or not version.is_prerelease
)
}

# N.B. these should be sorted so long as we iterate the commits in reverse order
Expand Down

0 comments on commit 6363525

Please sign in to comment.