public override void Setup(Context context) { context.Target = context.Argument("target", "Default"); context.Configuration = context.Argument("configuration", "Release"); context.LinkSources = context.Argument("linkSources", false); context.CoreOnly = context.Argument("CoreOnly", !context.IsRunningOnWindows()); context.Artifacts = "./packaging/"; // Build system information. var buildSystem = context.BuildSystem(); context.IsLocalBuild = buildSystem.IsLocalBuild; if (context.CoreOnly && !context.IsLocalBuild) { context.Warning("CoreOnly was specified on a non-local build. Artifacts may be versioned incorrectly!"); } context.AppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor; context.TravisCI = buildSystem.TravisCI.IsRunningOnTravisCI; context.IsTagged = IsBuildTagged(buildSystem); if (context.AppVeyor) { context.IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.AppVeyor.Environment.Repository.Name); context.IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.AppVeyor.Environment.Repository.Branch); } else if (context.TravisCI) { context.IsPullRequest = !string.IsNullOrEmpty(buildSystem.TravisCI.Environment.Repository.PullRequest); context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.TravisCI.Environment.Repository.Slug); context.IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.TravisCI.Environment.Build.Branch); } // Force publish? context.ForcePublish = context.Argument <bool>("forcepublish", false); // Setup projects. context.Projects = new Project[] { new Project { Name = "Octokit", Path = "./Octokit/Octokit.csproj", Publish = true }, new Project { Name = "Octokit.Reactive", Path = "./Octokit.Reactive/Octokit.Reactive.csproj", Publish = true }, new Project { Name = "Octokit.Tests", Path = "./Octokit.Tests/Octokit.Tests.csproj", UnitTests = true }, new Project { Name = "Octokit.Tests.Conventions", Path = "./Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj", ConventionTests = true }, new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true } }; // Install tools if (context.CoreOnly) { context.Information("Skipping tool installation for core-only build"); } else { context.Information("Installing tools..."); ToolInstaller.Install(context, "Octokit.CodeFormatter", "1.0.0-preview"); } context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.0.0", "dotnet-gitversion"); // Calculate semantic version. context.Version = BuildVersion.Calculate(context); context.Version.Prefix = context.Argument <string>("version", context.Version.Prefix); context.Version.Suffix = context.Argument <string>("suffix", context.Version.Suffix); context.Information("Version: {0}", context.Version.Prefix); context.Information("Version suffix: {0}", context.Version.Suffix); context.Information("Configuration: {0}", context.Configuration); context.Information("LinkSources: {0}", context.LinkSources); context.Information("CoreOnly: {0}", context.CoreOnly); context.Information("Target: {0}", context.Target); context.Information("AppVeyor: {0}", context.AppVeyor); context.Information("TravisCI: {0}", context.TravisCI); }
public override void Setup(Context context) { context.Target = context.Argument("target", "Default"); context.Configuration = context.Argument("configuration", "Release"); context.LinkSources = context.Argument("linkSources", false); context.FormatCode = context.Argument("formatCode", false); context.Artifacts = "./packaging/"; context.CodeCoverage = "./coverage-results/"; // Build system information. var buildSystem = context.BuildSystem(); context.IsLocalBuild = buildSystem.IsLocalBuild; context.GitHubActions = buildSystem.GitHubActions.IsRunningOnGitHubActions; context.AppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor; context.IsTagged = IsBuildTagged(buildSystem); if (context.AppVeyor) { context.IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.AppVeyor.Environment.Repository.Name); context.IsMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", buildSystem.AppVeyor.Environment.Repository.Branch); } else if (context.GitHubActions) { context.IsPullRequest = buildSystem.GitHubActions.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.GitHubActions.Environment.Workflow.Repository); context.IsMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", buildSystem.GitHubActions.Environment.Workflow.Ref); } // Force publish? context.ForcePublish = context.Argument <bool>("forcepublish", false); // Setup projects. context.Projects = new Project[] { new Project { Name = "Octokit", Path = "./Octokit/Octokit.csproj", Publish = true }, new Project { Name = "Octokit.Reactive", Path = "./Octokit.Reactive/Octokit.Reactive.csproj", Publish = true }, new Project { Name = "Octokit.Tests", Path = "./Octokit.Tests/Octokit.Tests.csproj", UnitTests = true }, new Project { Name = "Octokit.Tests.Conventions", Path = "./Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj", ConventionTests = true }, new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true } }; context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.1.3", "dotnet-gitversion"); // Calculate semantic version. context.Version = BuildVersion.Calculate(context); context.Version.Prefix = context.Argument <string>("version", context.Version.Prefix); context.Version.Suffix = context.Argument <string>("suffix", context.Version.Suffix); context.Information("Version: {0}", context.Version.Prefix); context.Information("Version suffix: {0}", context.Version.Suffix); context.Information("Configuration: {0}", context.Configuration); context.Information("LinkSources: {0}", context.LinkSources); context.Information("Target: {0}", context.Target); context.Information("AppVeyor: {0}", context.AppVeyor); context.Information("GitHub Actions: {0}", context.GitHubActions); }