Skip to content

Commit 3b42bc4

Browse files
committed
make major increment helper also reset build number (the build of the previous major should never carry over)
1 parent 105424d commit 3b42bc4

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Server/Initialization/VersionProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public record Entry
4343
public ulong Major { get; set; }
4444
public long Build { get; set; }
4545

46-
public Entry CopyIncrement() => this with { Build = Build + 1 };
47-
public Entry CopyIncrementMajor() => this with { Major = Major + 1 };
46+
public Entry NextBuild() => this with { Build = Build + 1 };
47+
public Entry NextMajor() => this with { Major = Major + 1, Build = 0 };
4848

4949
public override string ToString() =>
5050
Format

src/Server/Services/VersionProviderService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ public string GetNextVersion(ReleaseChannel rc, bool isMajorRelease = false) =>
3535
{
3636
ReleaseChannel.Stable => (
3737
isMajorRelease
38-
? _data.Stable.CopyIncrementMajor()
39-
: _data.Stable.CopyIncrement()
38+
? _data.Stable.NextMajor()
39+
: _data.Stable.NextBuild()
4040
).ToString(),
41-
ReleaseChannel.Canary => _data.Canary.CopyIncrement().ToString(), // canaries cannot move the major release, so ignore that boolean for this branch.
41+
ReleaseChannel.Canary => _data.Canary.NextBuild().ToString(), // canaries cannot move the major release, so ignore that boolean for this branch.
4242
_ => throw new ArgumentOutOfRangeException()
4343
};
4444

4545
public VersionProvider.Entry IncrementBuild(ReleaseChannel rc)
4646
{
4747
var entry = rc switch
4848
{
49-
ReleaseChannel.Stable => _data.Stable = _data.Stable.CopyIncrement(),
50-
ReleaseChannel.Canary => _data.Canary = _data.Canary.CopyIncrement(),
49+
ReleaseChannel.Stable => _data.Stable = _data.Stable.NextBuild(),
50+
ReleaseChannel.Canary => _data.Canary = _data.Canary.NextBuild(),
5151
_ => throw new ArgumentOutOfRangeException()
5252
};
5353

0 commit comments

Comments
 (0)