Skip to content

Commit

Permalink
build: split Version into VersionPrefix and VersionSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
Flash0ver committed Nov 7, 2023
1 parent 430b903 commit 99ddc4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "./build.schema.json",
"Solution": "src/FlashOWare.Tool.sln",
"Version": "1.0.0-prerelease0",
"VersionPrefix": "1.0.0",
"VersionSuffix": "prerelease0",
"NuGetSource": "https://api.nuget.org/v3/index.json"
}
29 changes: 13 additions & 16 deletions src/build/FlashOWare.Tool.Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
ImportSecrets = new[] { nameof(NuGetApiKey) })]
class Build : NukeBuild
{
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode

public static int Main () => Execute<Build>(x => x.Compile);
public static int Main() => Execute<Build>(x => x.Compile);

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
Expand All @@ -55,11 +49,12 @@ class Build : NukeBuild

[Solution] readonly Solution Solution;

[Parameter] readonly string Version;
[Parameter] readonly string VersionPrefix;
[Parameter] readonly string VersionSuffix;

[Parameter] readonly string NuGetSource;

[Parameter] [Secret] readonly string NuGetApiKey;
[Parameter][Secret] readonly string NuGetApiKey;

Target Restore => _ => _
.Executes(() =>
Expand All @@ -86,24 +81,26 @@ class Build : NukeBuild
.DependsOn(Compile)
.Executes(() =>
{
DotNetTest(_ => _
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetNoBuild(FinishedTargets.Contains(Compile))
.SetResultsDirectory(TestResultsDirectory));
DotNetTest(_ => _
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetNoBuild(FinishedTargets.Contains(Compile))
.SetResultsDirectory(TestResultsDirectory));
});

Target Pack => _ => _
.DependsOn(Compile)
.Requires(() => Version)
.Requires(() => VersionPrefix)
.Requires(() => VersionSuffix)
.Executes(() =>
{
DotNetPack(_ => _
.SetProject(Solution)
.SetConfiguration(Configuration)
.SetNoBuild(FinishedTargets.Contains(Compile))
.EnableNoLogo()
.SetVersion(Version)
.SetVersionPrefix(VersionPrefix)
.SetVersionSuffix(VersionSuffix)
.SetOutputDirectory(PackageDirectory)
.SetProcessExitHandler(p => p.ExitCode switch
{
Expand Down

0 comments on commit 99ddc4d

Please sign in to comment.