11// Install tools.
22#tool dotnet : ? package= GitVersion . Tool & version = 5.12 .0
33#tool dotnet: ? package = coveralls . net & version = 4.0 .1
4- #tool nuget: ? package = GitReleaseManager & version = 0.13 .0
5- #tool nuget: ? package = ReportGenerator & version = 5.1 .23
6- #tool nuget: ? package = xunit . runner . console & version = 2.5 .0
7- #tool nuget: ? package = CodecovUploader & version = 0.5 .0
4+ #tool nuget: https : //f.feedz.io/jericho/jericho/nuget/ ?package=GitReleaseManager&version=0.17.0-collaborators0003
5+ #tool nuget: ? package = ReportGenerator & version = 5.2 .0
6+ #tool nuget: ? package = xunit . runner . console & version = 2.6 .5
7+ #tool nuget: ? package = CodecovUploader & version = 0.7 .1
88
99// Install addins.
1010#addin nuget: ? package = Cake . Coveralls & version = 1.1 .0
@@ -51,9 +51,6 @@ var testCoverageExcludeFiles = new[]
5151var nuGetApiUrl = Argument< string > ( "NUGET_API_URL" , EnvironmentVariable ( "NUGET_API_URL" ) ) ;
5252var nuGetApiKey = Argument< string > ( "NUGET_API_KEY" , EnvironmentVariable ( "NUGET_API_KEY" ) ) ;
5353
54- var feedzioApiUrl = Argument< string > ( "FEEDZIO_API_URL" , EnvironmentVariable ( "FEEDZIO_API_URL" ) ) ;
55- var feedzioApiKey = Argument< string > ( "FEEDZIO_API_KEY" , EnvironmentVariable ( "FEEDZIO_API_KEY" ) ) ;
56-
5754var gitHubToken = Argument< string > ( "GITHUB_TOKEN" , EnvironmentVariable ( "GITHUB_TOKEN" ) ) ;
5855var gitHubUserName = Argument< string > ( "GITHUB_USERNAME" , EnvironmentVariable ( "GITHUB_USERNAME" ) ) ;
5956var gitHubPassword = Argument< string > ( "GITHUB_PASSWORD" , EnvironmentVariable ( "GITHUB_PASSWORD" ) ) ;
@@ -77,8 +74,9 @@ var benchmarkProject = $"{sourceFolder}{libraryName}.Benchmark/{libraryName}.Ben
7774var buildBranch = Context. GetBuildBranch( ) ;
7875var repoName = Context . GetRepoName ( ) ;
7976
80- var versionInfo = GitVersion ( new GitVersionSettings ( ) { OutputType = GitVersionOutput . Json } ) ;
81- var milestone = versionInfo. MajorMinorPatch;
77+ var versionInfo = ( GitVersion ) null; // Will be calculated in SETUP
78+ var milestone = string . Empty; // Will be calculated in SETUP
79+
8280var cakeVersion = typeof ( ICakeContext ) . Assembly . GetName ( ) . Version . ToString ( ) ;
8381var isLocalBuild = BuildSystem . IsLocalBuild ;
8482var isMainBranch = StringComparer . OrdinalIgnoreCase . Equals ( "main", buildBranch) ;
@@ -119,6 +117,10 @@ Setup(context =>
119117 context . Log . Verbosity = Verbosity . Diagnostic ;
120118 }
121119
120+ Information ( "Calculating version info..." ) ;
121+ versionInfo = GitVersion ( new GitVersionSettings ( ) { OutputType = GitVersionOutput . Json } ) ;
122+ milestone = versionInfo . MajorMinorPatch ;
123+
122124 Information ( "Building version {0} of {1} ({2}, {3}) using version {4} of Cake" ,
123125 versionInfo . LegacySemVerPadded ,
124126 libraryName ,
@@ -135,11 +137,6 @@ Setup(context =>
135137 isTagged
136138 ) ;
137139
138- Information ( "Feedz.io Info:\r \n \t Api Url: {0}\r \n \t Api Key: {1}" ,
139- feedzioApiUrl ,
140- string . IsNullOrEmpty ( feedzioApiKey ) ? "[NULL]" : new string ( '*' , feedzioApiKey . Length )
141- ) ;
142-
143140 Information ( "Nuget Info:\r \n \t Api Url: {0}\r \n \t Api Key: {1}" ,
144141 nuGetApiUrl ,
145142 string . IsNullOrEmpty ( nuGetApiKey ) ? "[NULL]" : new string ( '*' , nuGetApiKey . Length )
@@ -311,6 +308,8 @@ Task("Upload-Coverage-Result-Coveralls")
311308 . WithCriteria ( ( ) => isMainRepo )
312309 . Does ( ( ) =>
313310{
311+ if ( string . IsNullOrEmpty ( coverallsToken ) ) throw new InvalidOperationException ( "Could not resolve Coveralls token." ) ;
312+
314313 CoverallsNet ( new FilePath ( coverageFile ) , CoverallsNetReportType . OpenCover , new CoverallsNetSettings ( )
315314 {
316315 RepoToken = coverallsToken ,
@@ -331,6 +330,8 @@ Task("Upload-Coverage-Result-Codecov")
331330 . WithCriteria ( ( ) => isMainRepo )
332331 . Does ( ( ) =>
333332{
333+ if ( string . IsNullOrEmpty ( codecovToken ) ) throw new InvalidOperationException ( "Could not resolve CodeCov token." ) ;
334+
334335 Codecov ( new CodecovSettings
335336 {
336337 Files = new [ ] { coverageFile } ,
@@ -420,28 +421,6 @@ Task("Publish-NuGet")
420421 }
421422} ) ;
422423
423- Task( "Publish-Feedzio" )
424- . IsDependentOn ( "Create-NuGet-Package" )
425- . WithCriteria ( ( ) => ! isLocalBuild )
426- . WithCriteria ( ( ) => ! isPullRequest )
427- . WithCriteria ( ( ) => isMainRepo )
428- . Does ( ( ) =>
429- {
430- if ( string . IsNullOrEmpty ( feedzioApiKey ) ) throw new InvalidOperationException ( "Could not resolve Feedz.io API key." ) ;
431- if ( string . IsNullOrEmpty ( feedzioApiUrl ) ) throw new InvalidOperationException ( "Could not resolve Feedz.io API url." ) ;
432-
433- var settings = new DotNetNuGetPushSettings
434- {
435- Source = feedzioApiUrl ,
436- ApiKey = feedzioApiKey
437- } ;
438-
439- foreach ( var package in GetFiles ( outputDir + "*.nupkg" ) )
440- {
441- DotNetNuGetPush ( package , settings ) ;
442- }
443- } ) ;
444-
445424Task( "Create-Release-Notes" )
446425 . Does ( ( ) =>
447426{
@@ -544,7 +523,6 @@ Task("AppVeyor")
544523 . IsDependentOn ( "Upload-Coverage-Result-Codecov" )
545524 . IsDependentOn ( "Create-NuGet-Package" )
546525 . IsDependentOn ( "Upload-AppVeyor-Artifacts" )
547- . IsDependentOn ( "Publish-Feedzio" )
548526 . IsDependentOn ( "Publish-NuGet" )
549527 . IsDependentOn ( "Publish-GitHub-Release" )
550528 . Finally ( ( ) =>
0 commit comments