Merge claudedo/42d103cfae72447aa048e28121d6e733

This commit is contained in:
mika kuns
2026-08-10 14:57:37 +02:00
3 changed files with 26 additions and 2 deletions
+3 -1
View File
@@ -119,7 +119,9 @@ sealed class Program
var releases = sp.GetRequiredService<IReleaseClient>();
var informational = Assembly.GetEntryAssembly()?
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
// Strip MinVer build metadata ("+sha") and any prerelease suffix for the update-compare.
// Strip MinVer build metadata ("+sha") only — keep the prerelease suffix
// (e.g. "-alpha.0.14"), VersionComparer needs it to tell a dev build on
// main apart from a tagged release of the same numeric core.
var version = (informational ?? "0.0.0").Split('+')[0];
return new UpdateCheckService(releases, version);
});
+14 -1
View File
@@ -10,7 +10,17 @@ public static class VersionComparer
| !Version.TryParse(CoreVersion(current), out var cv);
if (unparseable) return new VersionCompareResult(false, true);
return new VersionCompareResult(lv > cv, false);
if (lv != cv) return new VersionCompareResult(lv > cv, false);
// Same numeric core: a MinVer dev build sitting on main between two tags
// reports a prerelease of its own guessed *next* version (e.g. after tag
// v1.4.0, main computes "1.4.1-alpha.0.12" — already ahead of the tag by
// core, handled above). But when a real release is tagged at exactly that
// guessed version, the tag itself has no prerelease suffix while a still-
// running dev build does — that dev build must still count as older, or a
// genuine new release would be silently missed.
var isNewer = HasPrerelease(current) && !HasPrerelease(latest);
return new VersionCompareResult(isNewer, false);
}
// Reduce a tag/version to its numeric core: drop a leading "v", MinVer build
@@ -18,4 +28,7 @@ public static class VersionComparer
// which System.Version can parse. So "v1.0.2-alpha+abc" -> "1.0.2".
private static string CoreVersion(string value)
=> (value ?? "").TrimStart('v', 'V').Split('+')[0].Split('-')[0];
private static bool HasPrerelease(string value)
=> (value ?? "").TrimStart('v', 'V').Split('+')[0].Contains('-');
}