Skip to content

Commit

Permalink
VCI-935: Filter out prereleases when looking for latest platform release
Browse files Browse the repository at this point in the history
  • Loading branch information
krankenbro committed Oct 22, 2024
1 parent d1969f0 commit 0ceeacb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ private static ManifestModuleInfo LoadModuleInfo(ModuleItem module, ManifestModu
PackageManager.ToFile(packageManifest, PackageManifestPath);
if (PlatformVersion.CurrentVersion == null)
{
var platformRelease = await GithubManager.GetPlatformRelease(null);
var platformRelease = await GithubManager.GetPlatformRelease();
PlatformVersion.CurrentVersion = SemanticVersion.Parse(platformRelease.TagName);
}
localModulesCatalog.Reload();
Expand Down
7 changes: 4 additions & 3 deletions src/VirtoCommerce.Build/PlatformTools/GithubManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class GithubManager
private static readonly string _platformRepo = "vc-platform";
private static readonly GitHubClient _client = new GitHubClient(new ProductHeaderValue("vc-build"));

public static Task<Release> GetPlatformRelease(string releaseTag)
public static Task<Release> GetPlatformRelease(string releaseTag = null)
{
return string.IsNullOrEmpty(releaseTag)
? GetLatestReleaseAsync(_githubUser, _platformRepo)
Expand All @@ -37,11 +37,12 @@ private static async Task<Release> GetLatestReleaseAsync(string repoUser, string
{
var releases = await _client.Repository.Release.GetAll(repoUser, repoName, new ApiOptions
{
PageSize = 5,
PageSize = 50,
PageCount = 1,

});

var release = releases.OrderByDescending(r => new Version(r.TagName.Trim())).FirstOrDefault();
var release = releases.Where(r => r.Prerelease == false).OrderByDescending(r => new Version(r.TagName.Trim())).FirstOrDefault();
return release;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static async Task<ExternalModuleCatalog> GetCatalog(IOptions<ExternalModu
{
if (_catalog == null)
{
var platformRelease = await GithubManager.GetPlatformRelease(null);
var platformRelease = await GithubManager.GetPlatformRelease();
PlatformVersion.CurrentVersion = SemanticVersion.Parse(platformRelease.TagName); // workaround to see all modules in the external catalog
var client = new ExternalModulesClient(options);
var logger = new LoggerFactory().CreateLogger<ExternalModuleCatalog>();
Expand Down

0 comments on commit 0ceeacb

Please sign in to comment.