33///////////////////////////////////////////////////////////////////////////////
44
55#tool dotnet : ? package= NuGetKeyVaultSignTool & version = 3.2 .3
6- #tool dotnet: ? package = AzureSignTool & version = 4 .0.1
7- #tool dotnet: ? package = GitReleaseManager . Tool & version = 0.15 .0
6+ #tool dotnet: ? package = AzureSignTool & version = 6 .0.0
7+ #tool dotnet: ? package = GitReleaseManager . Tool & version = 0.17 .0
88#tool dotnet: ? package = XamlStyler . Console & version = 3.2206 .4
99
1010#tool nuget: ? package = GitVersion . CommandLine & version = 5.12 .0
1111
12- #addin nuget: ? package = Cake . Figlet & version = 2.0 .1
13-
1412///////////////////////////////////////////////////////////////////////////////
1513// ARGUMENTS
1614///////////////////////////////////////////////////////////////////////////////
@@ -37,8 +35,8 @@ public class BuildData
3735 public DotNetVerbosity DotNetVerbosity { get ; }
3836 public bool IsLocalBuild { get ; set ; }
3937 public bool IsPullRequest { get ; set ; }
40- public bool IsDevelopBranch { get ; set ; }
41- public bool IsReleaseBranch { get ; set ; }
38+ public bool IsPrerelease { get ; set ; }
39+ public bool IsRunningOnCI { get ; set ; }
4240 public GitVersion GitVersion { get ; set ; }
4341
4442 public BuildData(
@@ -55,9 +53,7 @@ public class BuildData
5553 public void SetGitVersion ( GitVersion gitVersion )
5654 {
5755 GitVersion = gitVersion ;
58-
59- IsDevelopBranch = StringComparer . OrdinalIgnoreCase . Equals ( "develop ", GitVersion. BranchName) ;
60- IsReleaseBranch = StringComparer . OrdinalIgnoreCase . Equals ( "main ", GitVersion. BranchName) ;
56+ IsPrerelease = GitVersion . NuGetVersion . Contains ( "- ") ;
6157 }
6258}
6359
@@ -72,10 +68,9 @@ Setup<BuildData>(ctx =>
7268 throw new NotImplementedException ( $ "{ repoName } will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.") ;
7369 }
7470
75- Information ( Figlet ( repoName ) ) ;
71+ Spectre . Console . AnsiConsole . Write ( new Spectre . Console . FigletText ( repoName ) ) ;
7672
7773 var gitVersionPath = Context . Tools . Resolve ( "gitversion.exe" ) ;
78-
7974 Information ( "GitVersion : {0}" , gitVersionPath ) ;
8075
8176 var buildData = new BuildData (
@@ -85,6 +80,7 @@ Setup<BuildData>(ctx =>
8580 )
8681 {
8782 IsLocalBuild = BuildSystem . IsLocalBuild ,
83+ IsRunningOnCI = BuildSystem . GitHubActions . IsRunningOnGitHubActions || BuildSystem . AppVeyor . IsRunningOnAppVeyor ,
8884 IsPullRequest =
8985 ( BuildSystem . GitHubActions . IsRunningOnGitHubActions && BuildSystem . GitHubActions . Environment . PullRequest . IsPullRequest )
9086 || ( BuildSystem . AppVeyor . IsRunningOnAppVeyor && BuildSystem . AppVeyor . Environment . PullRequest . IsPullRequest )
@@ -97,15 +93,19 @@ Setup<BuildData>(ctx =>
9793 }
9894 buildData . SetGitVersion ( GitVersion ( new GitVersionSettings { ToolPath = gitVersionPath , OutputType = GitVersionOutput . Json } ) ) ;
9995
96+ Information ( "GitVersion : {0}" , gitVersionPath ) ;
10097 Information ( "Branch : {0}" , buildData . GitVersion . BranchName ) ;
10198 Information ( "Configuration : {0}" , buildData . Configuration ) ;
102- Information ( "IsLocalBuild : {0}" , buildData . IsLocalBuild ) ;
99+ Information ( "IsRunningOnCI : {0}" , buildData . IsRunningOnCI ) ;
100+ Information ( "IsPrerelease : {0}" , buildData . IsPrerelease ) ;
101+ Information ( "IsPrerelease : {0}" , buildData . IsPrerelease ) ;
103102 Information ( "Informational Version: {0}" , buildData . GitVersion . InformationalVersion ) ;
104103 Information ( "SemVer Version: {0}" , buildData . GitVersion . SemVer ) ;
105104 Information ( "AssemblySemVer Version: {0}" , buildData . GitVersion . AssemblySemVer ) ;
106105 Information ( "MajorMinorPatch Version: {0}" , buildData . GitVersion . MajorMinorPatch ) ;
107106 Information ( "NuGet Version: {0}" , buildData . GitVersion . NuGetVersion ) ;
108107 Information ( "Verbosity : {0}" , buildData . Verbosity ) ;
108+ Information ( "Publish folder : {0}" , publishDir ) ;
109109
110110 return buildData ;
111111} ) ;
@@ -141,11 +141,11 @@ Task("Build")
141141 var msbuildSettings = new DotNetMSBuildSettings
142142 {
143143 MaxCpuCount = 0 ,
144- Version = data . IsReleaseBranch ? data . GitVersion . MajorMinorPatch : data . GitVersion . NuGetVersion ,
144+ Version = data . GitVersion . NuGetVersion ,
145145 AssemblyVersion = data . GitVersion . AssemblySemVer ,
146146 FileVersion = data . GitVersion . AssemblySemFileVer ,
147147 InformationalVersion = data . GitVersion . InformationalVersion ,
148- ContinuousIntegrationBuild = data . IsReleaseBranch ,
148+ ContinuousIntegrationBuild = data . IsRunningOnCI ,
149149 ArgumentCustomization = args => args . Append ( "/m" ) . Append ( "/nr:false" ) // The /nr switch tells msbuild to quite once it's done
150150 } ;
151151 // msbuildSettings.FileLoggers.Add(
@@ -177,10 +177,11 @@ Task("Pack")
177177 var msbuildSettings = new DotNetMSBuildSettings
178178 {
179179 MaxCpuCount = 0 ,
180- Version = data . IsReleaseBranch ? data . GitVersion . MajorMinorPatch : data . GitVersion . NuGetVersion ,
180+ Version = data . GitVersion . NuGetVersion ,
181181 AssemblyVersion = data . GitVersion . AssemblySemVer ,
182182 FileVersion = data . GitVersion . AssemblySemFileVer ,
183- InformationalVersion = data . GitVersion . InformationalVersion
183+ InformationalVersion = data . GitVersion . InformationalVersion ,
184+ ContinuousIntegrationBuild = data . IsRunningOnCI
184185 }
185186 . WithProperty ( "IncludeBuildOutput" , "true" )
186187 . WithProperty ( "RepositoryBranch" , data . GitVersion . BranchName )
@@ -211,7 +212,7 @@ Task("Pack")
211212Task( "Sign" )
212213 . WithCriteria < BuildData > ( ( context , data ) => ! data . IsPullRequest )
213214 . ContinueOnError ( )
214- . Does ( ( ) =>
215+ . Does < BuildData > ( data =>
215216{
216217 var files = GetFiles ( "./src/GongSolutions.WPF.DragDrop/bin/**/*/GongSolutions.WPF.DragDrop.dll" ) ;
217218 SignFiles ( files , "GongSolutions.WPF.DragDrop, an easy to use drag'n'drop framework for WPF applications." ) ;
@@ -312,7 +313,7 @@ Task("CreateRelease")
312313 GitReleaseManagerCreate ( token , "punker76" , repoName , new GitReleaseManagerCreateSettings {
313314 Milestone = data . GitVersion . MajorMinorPatch ,
314315 Name = data . GitVersion . AssemblySemFileVer ,
315- Prerelease = data . IsDevelopBranch ,
316+ Prerelease = data . IsPrerelease ,
316317 TargetCommitish = data . GitVersion . BranchName ,
317318 WorkingDirectory = "."
318319 } ) ;
0 commit comments