Skip to content

Commit a3ec2b2

Browse files
committed
Allow build number to be negative (so build -1 can create a .0 build on first increment), rename NextVersionAsync to GetNextVersionAsync and fix a log in it
1 parent b21a470 commit a3ec2b2

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Client/UpdateClient/UpdateClient.Versioning.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public partial class UpdateClient
99
/// </summary>
1010
/// <param name="rc">The target release channel.</param>
1111
/// <returns>Plain version string if request success; null if non-200 series HTTP status code or if not configured to support this endpoint.</returns>
12-
public async Task<string?> NextVersionAsync(ReleaseChannel rc)
12+
public async Task<string?> GetNextVersionAsync(ReleaseChannel rc)
1313
{
1414
var httpRequest = new HttpRequestMessage(HttpMethod.Get,
1515
$"{Constants.FullRouteName_Api_Versioning}/{Constants.RouteName_Api_Versioning_GetNextVersion}?rc={rc.QueryStringValue}");
@@ -19,7 +19,7 @@ public partial class UpdateClient
1919

2020
if (!resp.IsSuccessStatusCode)
2121
{
22-
Log("Increment version failed: received status code {0}; content body: {1}",
22+
Log("Getting next version failed: received status code {0}; content body: {1}",
2323
[Enum.GetName(resp.StatusCode) ?? $"{(int)resp.StatusCode}", await resp.Content.ReadAsStringAsync()]);
2424
return null;
2525
}

src/Server/Config.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ public static void TryUseVersionProvider(this WebApplicationBuilder builder, str
6868
{
6969
Format = "1.{MAJOR}.0",
7070
Major = 3,
71-
Build = 0
71+
Build = -1
7272
},
7373
Canary = new()
7474
{
7575
Format = "1.{MAJOR}.{BUILD}",
7676
Major = 3,
77-
Build = 2000
77+
Build = 0
7878
}
7979
}, JSCtx.ReadableDefault.VersionProvider));
8080
}

src/Server/Initialization/VersionProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class VersionProvider
2222
public void IncrementAndReset()
2323
{
2424
Stable.Major++;
25-
Stable.Build = 0;
25+
Stable.Build = -1;
2626
Canary.Major = Stable.Major;
2727
Canary.Build = 0;
2828
Save();
@@ -41,7 +41,7 @@ public record Entry
4141
{
4242
public string Format { get; set; } = "1.{MAJOR}.{BUILD}";
4343
public ulong Major { get; set; }
44-
public ulong Build { get; set; }
44+
public long Build { get; set; }
4545

4646
public Entry CopyIncrement() => this with { Build = Build + 1 };
4747

0 commit comments

Comments
 (0)