Skip to content

Commit 791c77d

Browse files
committed
fix: ignore build metadata releases in updater
1 parent e8fa813 commit 791c77d

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

headdb-platforms/headdb-paper/src/main/java/io/github/silentdevelopment/headdb/paper/updater/GitHubReleaseUpdateChecker.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public final class GitHubReleaseUpdateChecker {
2424
public static final String REPOSITORY = "SilentDevelopment/HeadDB";
2525

2626
private static final int MAX_RELEASES = 50;
27+
2728
private final HttpClient httpClient;
2829
private final Duration readTimeout;
2930
private final String userAgent;
@@ -42,7 +43,11 @@ public GitHubReleaseUpdateChecker(
4243
.build();
4344
}
4445

45-
public @NotNull UpdateCheckResult check(@NotNull String currentVersion, boolean includePrereleases, boolean includeBuilds) throws IOException, InterruptedException {
46+
public @NotNull UpdateCheckResult check(
47+
@NotNull String currentVersion,
48+
boolean includePrereleases,
49+
boolean includeBuilds
50+
) throws IOException, InterruptedException {
4651
Objects.requireNonNull(currentVersion, "currentVersion");
4752

4853
HeadDBVersion current = HeadDBVersion.parse(currentVersion);
@@ -73,8 +78,12 @@ public GitHubReleaseUpdateChecker(
7378
continue;
7479
}
7580

81+
if (isBuildReleaseTag(tagName)) {
82+
continue;
83+
}
84+
7685
HeadDBVersion candidateVersion = HeadDBVersion.parse(tagName);
77-
UpdateKind candidateKind = candidateVersion.updateKindComparedTo(current, includeBuilds);
86+
UpdateKind candidateKind = candidateVersion.updateKindComparedTo(current, false);
7887

7988
if (candidateKind == UpdateKind.NONE) {
8089
continue;
@@ -118,7 +127,12 @@ public GitHubReleaseUpdateChecker(
118127
return parsed.getAsJsonArray();
119128
}
120129

121-
private static @NotNull GitHubRelease releaseFrom(@NotNull JsonObject object, @NotNull String tagName, boolean prerelease, @NotNull HeadDBVersion version) {
130+
private static @NotNull GitHubRelease releaseFrom(
131+
@NotNull JsonObject object,
132+
@NotNull String tagName,
133+
boolean prerelease,
134+
@NotNull HeadDBVersion version
135+
) {
122136
String name = stringValue(object, "name");
123137

124138
if (name == null || name.isBlank()) {
@@ -183,6 +197,10 @@ public GitHubReleaseUpdateChecker(
183197
return fallback;
184198
}
185199

200+
private static boolean isBuildReleaseTag(@NotNull String tagName) {
201+
return tagName.toLowerCase(Locale.ROOT).contains("+build.");
202+
}
203+
186204
private static @NotNull String encodeRepository(@NotNull String repository) {
187205
String normalized = repository.trim();
188206
int slash = normalized.indexOf('/');
@@ -238,4 +256,4 @@ private record ReleaseAsset(@Nullable String name, @Nullable String downloadUrl)
238256

239257
}
240258

241-
}
259+
}

0 commit comments

Comments
 (0)