From 134b8edd09ad7dad0a17728eae4e9f50e16d3fe0 Mon Sep 17 00:00:00 2001 From: Andrey Akinshin Date: Thu, 5 Oct 2023 14:19:37 +0200 Subject: [PATCH] [build] Automatic NextVersion evaluation --- build/BenchmarkDotNet.Build/Program.cs | 3 +++ build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build/BenchmarkDotNet.Build/Program.cs b/build/BenchmarkDotNet.Build/Program.cs index ce291ecd0f..f099c38094 100644 --- a/build/BenchmarkDotNet.Build/Program.cs +++ b/build/BenchmarkDotNet.Build/Program.cs @@ -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) } }; diff --git a/build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs b/build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs index 0562639a9b..fb9aa895ec 100644 --- a/build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs +++ b/build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs @@ -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; @@ -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);