public override void Run(IBuildContext context) { // // Generate change log // var versionOracle = context.GitVersioningGetVersion(); var args = new ProcessArgumentBuilder() .Append($"--currentVersion {versionOracle.NuGetPackageVersion}") .Append($"--versionRange [{versionOracle.NuGetPackageVersion}]") .Append($"--outputpath") .Append(context.Output.ChangeLogFile.FullPath) .Append($"--template GitHubRelease") .Append($"--verbose"); var dotnetCoreRunSettings = new DotNetRunSettings() { Configuration = context.BuildSettings.Configuration, NoBuild = true, NoRestore = true, Framework = "net6.0", }; if (context.GitHub.TryGetAccessToken() is string accessToken) { context.Log.Information("GitHub access token specified, activating changelog's GitHub integration"); args.Append("--integrationProvider"); args.AppendQuoted("GitHub"); dotnetCoreRunSettings.EnvironmentVariables["CHANGELOG__INTEGRATIONS__GITHUB__ACCESSTOKEN"] = accessToken; } else { context.Log.Warning("No GitHub access token specified, generating change log without GitHub integration"); } context.DotNetRun( "./src/ChangeLog/Grynwald.ChangeLog.csproj", args, dotnetCoreRunSettings ); // // Publish change log // if (context.AzurePipelines.IsActive) { context.AzurePipelines.Commands.UploadArtifact( folderName: "", file: context.Output.ChangeLogFile, artifactName: context.AzurePipelines.ArtifactNames.ChangeLog ); } }
public void TestCommon() { var settings = new DotNetRunSettings() .SetProcessToolPath("/path/to/dotnet") .SetProcessEnvironmentVariable("key", "value") .SetProcessExecutionTimeout(1_000) .SetProcessArgumentConfigurator(_ => _ .Add("/switch")) .EnableProcessLogInvocation(); settings.ProcessToolPath.Should().Be("/path/to/dotnet"); settings.ProcessEnvironmentVariables.Should().ContainSingle(x => x.Key == "key" && x.Value == "value"); settings.ProcessExecutionTimeout.Should().Be(1_000); settings.ProcessArgumentConfigurator.Invoke(new Arguments()).RenderForOutput().Should().Be("/switch"); }