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