1616using Nuke . Common . Utilities . Collections ;
1717using Octokit ;
1818using Serilog ;
19- using static Nuke . Common . IO . CompressionTasks ;
20- using static Nuke . Common . IO . FileSystemTasks ;
2119using static Nuke . Common . Tools . DotNet . DotNetTasks ;
2220
2321[ GitHubActions (
4947[ ShutdownDotNetAfterServerBuild ]
5048class Build : NukeBuild
5149{
52- /// Support plugins are available for:
53- /// - JetBrains ReSharper https://nuke.build/resharper
54- /// - JetBrains Rider https://nuke.build/rider
55- /// - Microsoft VisualStudio https://nuke.build/visualstudio
56- /// - Microsoft VSCode https://nuke.build/vscode
5750 public static int Main ( ) => Execute < Build > ( x => x . Compile ) ;
5851
5952 protected override void OnBuildInitialized ( )
@@ -83,14 +76,17 @@ protected override void OnBuildInitialized()
8376 Log . Information ( "NuGet Version: {NuGetVersion}" , GitVersion . NuGetVersion ) ;
8477 }
8578
86- [ Parameter ( "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" ) ] readonly Configuration Configuration = IsLocalBuild ? Configuration . Debug : Configuration . Release ;
79+ [ Parameter ( "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" ) ]
80+ readonly Configuration Configuration = IsLocalBuild ? Configuration . Debug : Configuration . Release ;
8781
88- [ Solution ( GenerateProjects = true , SuppressBuildProjectCheck = false ) ] readonly Solution Solution ;
89- [ GitRepository ] readonly GitRepository GitRepository ;
90- [ GitVersion ( Framework = "net6.0" , NoFetch = true ) ] readonly GitVersion GitVersion ;
82+ [ Solution ( GenerateProjects = true , SuppressBuildProjectCheck = false ) ]
83+ readonly Solution Solution ;
84+ [ GitRepository ]
85+ readonly GitRepository GitRepository ;
86+ [ GitVersion ( Framework = "net6.0" , NoFetch = true ) ]
87+ readonly GitVersion GitVersion ;
9188
9289 AbsolutePath SourceDirectory => RootDirectory / "src" ;
93- AbsolutePath TestsDirectory => RootDirectory / "tests" ;
9490 AbsolutePath OutputDirectory => RootDirectory / "artifacts" ;
9591
9692 Target Clean => _ => _
@@ -99,9 +95,8 @@ protected override void OnBuildInitialized()
9995 {
10096 try
10197 {
102- SourceDirectory . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( EnsureCleanDirectory ) ;
103- TestsDirectory . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( EnsureCleanDirectory ) ;
104- OutputDirectory . GlobDirectories ( "*.*" ) . ForEach ( EnsureCleanDirectory ) ;
98+ SourceDirectory . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
99+ OutputDirectory . CreateOrCleanDirectory ( ) ;
105100 }
106101 catch
107102 {
@@ -144,11 +139,12 @@ protected override void OnBuildInitialized()
144139 . SetAssemblyVersion ( GitVersion . AssemblySemVer )
145140 . SetFileVersion ( GitVersion . AssemblySemFileVer )
146141 . SetInformationalVersion ( GitVersion . InformationalVersion )
147- . SetFramework ( "net5 .0-windows" )
142+ . SetFramework ( "net8 .0-windows" )
148143 . SetRuntime ( "win-x64" )
149144 . DisablePublishTrimmed ( )
150145 . EnableSelfContained ( )
151146 . EnablePublishSingleFile ( )
147+ . EnableDeterministic ( )
152148 . SetProperty ( "IncludeNativeLibrariesForSelfExtract" , true )
153149 . SetProperty ( "IncludeAllContentForSelfExtract" , true )
154150 ) ;
@@ -160,13 +156,13 @@ protected override void OnBuildInitialized()
160156 . OnlyWhenStatic ( ( ) => EnvironmentInfo . IsWin )
161157 . Executes ( ( ) =>
162158 {
163- Compress ( SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net47" , OutputDirectory / $ "IconPacks.Browser-net47-v{ GitVersion . NuGetVersion } .zip") ;
164- Compress ( SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net5 .0-windows" / "win-x64" / "publish" , OutputDirectory / $ "IconPacks.Browser-net50 -v{ GitVersion . NuGetVersion } .zip") ;
159+ ( SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net47" ) . ZipTo ( OutputDirectory / $ "IconPacks.Browser-net47-v{ GitVersion . NuGetVersion } .zip") ;
160+ ( SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net8 .0-windows" / "win-x64" / "publish" ) . ZipTo ( OutputDirectory / $ "IconPacks.Browser-net8 -v{ GitVersion . NuGetVersion } .zip") ;
165161 } ) ;
166162
167163 Target SignArtifacts => _ => _
168164 . DependsOn ( Publish )
169- . OnlyWhenStatic ( ( ) => EnvironmentInfo . IsWin )
165+ . OnlyWhenStatic ( ( ) => EnvironmentInfo . IsWin && ! IsLocalBuild )
170166 . Executes ( ( ) =>
171167 {
172168 var files = SourceDirectory . GlobFiles ( "**/bin/**/IconPacks.Browser.exe" ) . Select ( p => p . ToString ( ) ) ;
@@ -227,12 +223,12 @@ private void UploadReleaseAssetToGithub(IGitHubClient client, Release release, A
227223 Log . Information ( "Done Uploading {FileName} to the release" , asset . Name ) ;
228224 }
229225
230- [ Parameter ( "GitHub Api key" ) ] [ Secret ] string GithubToken = null ;
231- [ Parameter ] [ Secret ] readonly string AzureKeyVaultUrl ;
232- [ Parameter ] [ Secret ] readonly string AzureKeyVaultClientId ;
233- [ Parameter ] [ Secret ] readonly string AzureKeyVaultTenantId ;
234- [ Parameter ] [ Secret ] readonly string AzureKeyVaultClientSecret ;
235- [ Parameter ] [ Secret ] readonly string AzureKeyVaultCertificate ;
226+ [ Parameter ( "GitHub Api key" ) ] [ Secret ] string GithubToken = null ;
227+ [ Parameter ] [ Secret ] readonly string AzureKeyVaultUrl ;
228+ [ Parameter ] [ Secret ] readonly string AzureKeyVaultClientId ;
229+ [ Parameter ] [ Secret ] readonly string AzureKeyVaultTenantId ;
230+ [ Parameter ] [ Secret ] readonly string AzureKeyVaultClientSecret ;
231+ [ Parameter ] [ Secret ] readonly string AzureKeyVaultCertificate ;
236232
237233 void SignFiles ( IEnumerable < string > files , string description , string descriptionUrl )
238234 {
@@ -244,11 +240,11 @@ void SignFiles(IEnumerable<string> files, string description, string description
244240 . ToggleNoPageHashing ( )
245241 . SetTimestampRfc3161Url ( "http://timestamp.digicert.com" )
246242 . SetTimestampDigest ( AzureSignToolDigestAlgorithm . sha256 )
247- . SetKeyVaultUrl ( EnvironmentInfo . GetParameter < string > ( nameof ( AzureKeyVaultUrl ) ) )
248- . SetKeyVaultClientId ( EnvironmentInfo . GetParameter < string > ( nameof ( AzureKeyVaultClientId ) ) )
249- . SetKeyVaultTenantId ( EnvironmentInfo . GetParameter < string > ( nameof ( AzureKeyVaultTenantId ) ) )
250- . SetKeyVaultClientSecret ( EnvironmentInfo . GetParameter < string > ( nameof ( AzureKeyVaultClientSecret ) ) )
251- . SetKeyVaultCertificateName ( EnvironmentInfo . GetParameter < string > ( nameof ( AzureKeyVaultCertificate ) ) )
243+ . SetKeyVaultUrl ( EnvironmentInfo . GetVariable < string > ( nameof ( AzureKeyVaultUrl ) ) )
244+ . SetKeyVaultClientId ( EnvironmentInfo . GetVariable < string > ( nameof ( AzureKeyVaultClientId ) ) )
245+ . SetKeyVaultTenantId ( EnvironmentInfo . GetVariable < string > ( nameof ( AzureKeyVaultTenantId ) ) )
246+ . SetKeyVaultClientSecret ( EnvironmentInfo . GetVariable < string > ( nameof ( AzureKeyVaultClientSecret ) ) )
247+ . SetKeyVaultCertificateName ( EnvironmentInfo . GetVariable < string > ( nameof ( AzureKeyVaultCertificate ) ) )
252248 ;
253249
254250 AzureSignToolTasks . AzureSignTool ( azureSignToolSettings ) ;
0 commit comments