Skip to content

Commit

Permalink
fix: Prerelease versioning scheme produced invalid semvers. (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelday authored Jan 14, 2023
1 parent 7fdccea commit 236d7a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ Task("get-version")
.Does(() => {
if (isPrerelease)
{
// Set version to a YYYY.MMDD.HHMM formatted string.
version = DateTime.UtcNow.ToString("yyyy.MMdd.HHmm");
// Generate a correctly sortable and valid semver based on the current date and time.
var now = DateTime.UtcNow;
var secondOfDay = (((now.Hour * 60) + now.Minute) * 60) + now.Second;

// Adding 200 due to the previous incorrect versioning scheme that, while invalid, may still be sorted by
// something (VS marketplace, maybe? Don't really feel like finding out.)
version = $"{now.Year}.{now.DayOfYear + 200}.{secondOfDay}";

return;
}

Expand Down

0 comments on commit 236d7a8

Please sign in to comment.