Skip to content

Commit

Permalink
[build] Automatic NextVersion evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyAkinshin committed Oct 5, 2023
1 parent 9dd7b6f commit 134b8ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions build/BenchmarkDotNet.Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ public HelpInfo GetHelp() => new()
new Example(Name)
.WithArgument(KnownOptions.Stable)
.WithArgument(KnownOptions.NextVersion, "0.1.1729")
.WithArgument(KnownOptions.Push),
new Example(Name)
.WithArgument(KnownOptions.Stable)
.WithArgument(KnownOptions.Push)
}
};
Expand Down
9 changes: 7 additions & 2 deletions build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BenchmarkDotNet.Build.Helpers;
using BenchmarkDotNet.Build.Meta;
Expand Down Expand Up @@ -34,9 +33,15 @@ public void Run()
else
EnvVar.NuGetToken.SetEmpty();

var nextVersion = KnownOptions.NextVersion.AssertHasValue(context);
var currentVersion = context.VersionHistory.CurrentVersion;
var tag = "v" + currentVersion;
var nextVersion = KnownOptions.NextVersion.Resolve(context);
if (nextVersion == "")
{
var version = Version.Parse(currentVersion);
nextVersion = $"{version.Major}.{version.Minor}.{version.Build + 1}";
context.Information($"Evaluated NextVersion: {nextVersion}");
}

context.GitRunner.Tag(tag);

Expand Down

0 comments on commit 134b8ed

Please sign in to comment.