Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

[update-config.csx] Better detection of GPS packages prefixed with a "1". #893

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion build/scripts/update-config.csx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ foreach (var art in config[0].Artifacts.Where (a => !a.DependencyOnly)) {
if (options.Update)
{
var new_version = GetLatestVersion (a)?.ToString ();
var prefix = art.NugetVersion.StartsWith ("1" + art.Version + ".") ? "1" : string.Empty;
var prefix = GetThreePartVersion (art.NugetVersion) == "1" + GetThreePartVersion (art.Version) ? "1" : string.Empty;

art.Version = new_version;
art.NugetVersion = prefix + new_version;
Expand Down Expand Up @@ -223,6 +223,20 @@ static SemanticVersion GetVersion (string s)

return SemanticVersion.Parse (version + tag);
}

static string GetThreePartVersion (string version)
{
// Change 121.0.0.0-beta1 to 121.0.0
var hyphen = version.IndexOf ('-');
version = hyphen >= 0 ? version.Substring (0, hyphen) : version;

var parts = version.Split ('.');

if (parts.Count () < 3)
return version;

return $"{parts[0]}.{parts[1]}.{parts[2]}";
}

public static async Task<bool> DoesNuGetPackageAlreadyExist (string package, string version)
{
Expand Down