diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index aa2cc4d2..85fe3871 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -109,6 +109,14 @@ "Quiet", "Verbose" ] + }, + "VersionedFolder": { + "type": "string", + "description": "Insert version into the artefacts - Default is 'True'", + "enum": [ + "False", + "True" + ] } } } diff --git a/BuildAndDeploy.ps1 b/BuildAndDeploy.ps1 index 5e74f1ae..78edca6a 100644 --- a/BuildAndDeploy.ps1 +++ b/BuildAndDeploy.ps1 @@ -3,7 +3,7 @@ $ErrorActionPreference = 'Stop' cp .\Source\global.json .\global.json cd .\Tools\NukeBuild -.\build.cmd Test Publish +.\build.cmd Test Publish --VersionedFolder False cd ..\..\Artifacts\latest .\install-update.ps1 diff --git a/Tools/NukeBuild/Build.cs b/Tools/NukeBuild/Build.cs index 5cd6c853..7081a1d8 100644 --- a/Tools/NukeBuild/Build.cs +++ b/Tools/NukeBuild/Build.cs @@ -56,11 +56,15 @@ class Build : NukeBuild [Parameter("Configuration to build - Default is 'Release'")] readonly Configuration Configuration = Configuration.Release; + [Parameter("Insert version into the artefacts - Default is 'True'")] + readonly BuildToVersionedFolder VersionedFolder = BuildToVersionedFolder.True; + AbsolutePath SourceDirectory => RootDirectory; AbsolutePath OutputDirectory => RootDirectory / "Artifacts"; - AbsolutePath OutputLatestDirectory => OutputDirectory / VersionedName; + AbsolutePath OutputLatestDirectory => + OutputDirectory / (VersionedFolder == BuildToVersionedFolder.True ? VersionedName : "latest"); [Solution(GenerateProjects = true)] readonly Solution Solution; diff --git a/Tools/NukeBuild/BuildToVersionedFolder.cs b/Tools/NukeBuild/BuildToVersionedFolder.cs new file mode 100644 index 00000000..a3b48bbe --- /dev/null +++ b/Tools/NukeBuild/BuildToVersionedFolder.cs @@ -0,0 +1,14 @@ +using System.ComponentModel; +using Nuke.Common.Tooling; + +[TypeConverter(typeof(TypeConverter))] +public class BuildToVersionedFolder : Enumeration +{ + public static BuildToVersionedFolder True = new() { Value = nameof(True) }; + public static BuildToVersionedFolder False = new() { Value = nameof(False) }; + + public static implicit operator string(BuildToVersionedFolder configuration) + { + return configuration.Value; + } +} \ No newline at end of file