mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
[Feat] Allow build version to be passed in to build.ps1 via command line (#2864)
This commit is contained in:
@@ -24,8 +24,9 @@ Param(
|
||||
[string]$Target = "Default",
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
[string]$ForceVersion = "0.0.0",
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Normal",
|
||||
[string]$Verbosity = "Normal",
|
||||
[switch]$WhatIf,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
@@ -97,6 +98,7 @@ if (!(Test-Path $NugetPath)) {
|
||||
$Arguments = @{
|
||||
target=$Target;
|
||||
configuration=$Configuration;
|
||||
forceVersion=$ForceVersion;
|
||||
verbosity=$Verbosity;
|
||||
dryrun=$WhatIf;
|
||||
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };
|
||||
|
||||
@@ -9,6 +9,7 @@ public class Context : FrostingContext
|
||||
{
|
||||
public string Target { get; set; }
|
||||
public new string Configuration { get; set; }
|
||||
public string ForceVersion { get; set; }
|
||||
public bool FormatCode { get; set; }
|
||||
public BuildVersion Version { get; set; }
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ public class Lifetime : FrostingLifetime<Context>
|
||||
{
|
||||
context.Target = context.Argument("target", "Default");
|
||||
context.Configuration = context.Argument("configuration", "Release");
|
||||
context.ForceVersion = context.Argument<string>("forceVersion", "0.0.0");
|
||||
context.FormatCode = context.Argument("formatCode", false);
|
||||
|
||||
context.Artifacts = "./packaging/";
|
||||
@@ -46,7 +47,7 @@ public class Lifetime : FrostingLifetime<Context>
|
||||
ToolInstaller.DotNetToolInstall(context, "coverlet.console", "1.7.2", "coverlet");
|
||||
|
||||
// Calculate semantic version.
|
||||
context.Version = BuildVersion.Calculate(context);
|
||||
context.Version = context.ForceVersion != "0.0.0" ? new BuildVersion(context.ForceVersion, null, null) : BuildVersion.Calculate(context);
|
||||
context.Version.Prefix = context.Argument<string>("version", context.Version.Prefix);
|
||||
context.Version.Suffix = context.Argument<string>("suffix", context.Version.Suffix);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user