diff --git a/tools/releaser/src/main/java/releaser/GitRepository.java b/tools/releaser/src/main/java/releaser/GitRepository.java index 77e5884..6fc9eb4 100644 --- a/tools/releaser/src/main/java/releaser/GitRepository.java +++ b/tools/releaser/src/main/java/releaser/GitRepository.java @@ -4,9 +4,12 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.regex.Pattern; class GitRepository { + private static final Pattern VERSION_TAG_PATTERN = Pattern.compile("^v[0-9]+(:?\\.[0-9]+)*$"); + private final Git git; protected final BranchingModel branchingModel; protected String currentBranch; @@ -121,6 +124,7 @@ public Optional latestReleaseBranchVersion(Version baseVersion) { public Optional latestTaggedVersionForBaseVersion(Version baseVersion) { return tags(baseVersion).stream() + .filter(tag -> VERSION_TAG_PATTERN.matcher(tag).matches()) .map(tag -> tag.replaceFirst("^v", "")) .max(Version::compare) .map(Version::parse);