Skip to content

Commit

Permalink
fix: limit updates for stable to the current Major.Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jul 30, 2024
1 parent 46fb898 commit 7e47cc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/Uno.Sdk.Updater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static async Task<ManifestGroup> UpdateGroup(ManifestGroup group, NuGetVersion u
var packageId = group.Packages.FirstOrDefault(x => x.Contains("WinUI", StringComparison.InvariantCultureIgnoreCase) && x.Contains("Uno", StringComparison.InvariantCultureIgnoreCase)) ??
group.Packages.First();

var version = await client.GetVersionAsync(packageId, preview);
var version = await client.GetVersionAsync(packageId, preview, group.Version);
version = !string.IsNullOrEmpty(group.Version) && NuGetVersion.Parse(version) < NuGetVersion.Parse(group.Version) ? group.Version : version;
var newGroup = group with { Version = version };

Expand Down
6 changes: 6 additions & 0 deletions tools/Uno.Sdk.Updater/Services/NuGetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ public async Task<string> GetVersionAsync(string packageId, bool preview, string
if (!string.IsNullOrEmpty(minimumVersionString) && NuGetVersion.TryParse(minimumVersionString, out var minimumVersion))
{
versions = versions.Where(x => minimumVersion.Version <= x.Version);

if (UnoVersion.HasValue && !UnoVersion.Value.IsPreview)
{
var maxVersion = NuGetVersion.Parse($"{minimumVersion.Version.Major}.{minimumVersion.Version.Minor + 1}.0");
versions = versions.Where(x => x < maxVersion);
}
}

if (!versions.Any())
Expand Down

0 comments on commit 7e47cc2

Please sign in to comment.