11// Install .NET Core Global tools.
2- #tool "dotnet:?package=dotnet-reportgenerator-globaltool&version=5.0.0"
3- #tool "dotnet:?package=coveralls.net&version=3.0.0"
4- #tool "dotnet:?package=dotnet-sonarscanner&version=5.4.0"
5- #tool nuget : ? package= docfx . console & version = 2.58 .9
6- #tool nuget: ? package = KuduSync . NET & version = 1.5 .3
2+ #tool "dotnet:?package=dotnet-reportgenerator-globaltool&version=5.4.1"
3+ #tool "dotnet:?package=coveralls.net&version=4.0.1"
4+ #tool "dotnet:?package=dotnet-sonarscanner&version=9.0.2"
5+ #tool nuget : ? package= KuduSync . NET & version = 1.5 .4
76
87// Install addins
9- #addin nuget: ? package = Cake . Coverlet & version = 2.5 .4
10- #addin nuget: ? package = Cake . Sonar & version = 1.1 .26
11- #addin nuget: ? package = Cake . DocFx & version = 1.0 .0
12- #addin nuget: ? package = Cake . Git & version = 1.1 .0
13- #addin nuget: ? package = Cake . Kudu & version = 1.3 .0
8+ #addin nuget: ? package = Cake . Coverlet & version = 4.0 .1
9+ #addin nuget: ? package = Cake . Sonar & version = 1.1 .33
10+ #addin nuget: ? package = Cake . Git & version = 4.0 .0
11+ #addin nuget: ? package = Cake . Kudu & version = 3.0 .0
1412
1513 #r "System.Text.Json"
1614 #r "System . IO "
@@ -83,15 +81,15 @@ Task("SonarBegin")
8381 Url = "https://sonarcloud.io" ,
8482 Exclusions = "test/**,examples/**" ,
8583 OpenCoverReportsPath = $ "{ coveragePath } /*.xml",
86- Login = sonarToken ,
84+ Token = sonarToken ,
8785 VsTestReportsPath = $ "{ artifactsPath } /*.TestResults.xml",
8886 } ) ;
8987 } ) ;
9088
9189Task( "Build" )
9290 . Does ( ( ) =>
9391 {
94- DotNetCoreBuild ( "TrueLayer.sln" , new DotNetCoreBuildSettings
92+ DotNetBuild ( "TrueLayer.sln" , new DotNetBuildSettings
9593 {
9694 Configuration = configuration
9795 } ) ;
@@ -104,7 +102,7 @@ Task("Test")
104102 {
105103 var projectName = project . GetFilenameWithoutExtension ( ) ;
106104
107- var testSettings = new DotNetCoreTestSettings
105+ var testSettings = new DotNetTestSettings
108106 {
109107 NoBuild = true ,
110108 Configuration = configuration ,
@@ -122,15 +120,15 @@ Task("Test")
122120 //Threshold = coverageThreshold
123121 } ;
124122
125- DotNetCoreTest ( project . ToString ( ) , testSettings , coverletSettings ) ;
123+ DotNetTest ( project . ToString ( ) , testSettings , coverletSettings ) ;
126124 }
127125 } ) ;
128126
129127
130128Task( "Pack" )
131129 . Does ( ( ) =>
132130 {
133- var settings = new DotNetCorePackSettings
131+ var settings = new DotNetPackSettings
134132 {
135133 Configuration = configuration ,
136134 OutputDirectory = artifactsPath ,
@@ -139,7 +137,7 @@ Task("Pack")
139137
140138 foreach ( var file in GetFiles ( packFiles ) )
141139 {
142- DotNetCorePack ( file . ToString ( ) , settings ) ;
140+ DotNetPack ( file . ToString ( ) , settings ) ;
143141 }
144142 } ) ;
145143
@@ -202,7 +200,7 @@ Task("PublishPackages")
202200 {
203201 foreach ( var package in GetFiles ( packages ) )
204202 {
205- DotNetCoreNuGetPush ( package . ToString ( ) , new DotNetCoreNuGetPushSettings {
203+ DotNetNuGetPush ( package . ToString ( ) , new DotNetNuGetPushSettings {
206204 ApiKey = BuildContext . NugetApiKey ,
207205 Source = BuildContext . NugetApiUrl ,
208206 SkipDuplicate = true
@@ -216,86 +214,18 @@ Task("SonarEnd")
216214 {
217215 SonarEnd ( new SonarEndSettings
218216 {
219- Login = sonarToken
217+ Token = sonarToken
220218 } ) ;
221219 } ) ;
222220
223- Task( "BuildDocs" )
224- . Does ( ( ) =>
225- {
226- Information ( "Extracting API Metadata" ) ;
227- DocFxMetadata ( docFxConfig ) ;
228-
229- Information ( "Building Docs" ) ;
230- DocFxBuild ( docFxConfig ) ;
231- } ) ;
232-
233- Task( "ServeDocs" )
234- . IsDependentOn ( "BuildDocs" )
235- . Does ( ( ) =>
236- {
237- using ( var process = DocFxServeStart ( sitePath ) )
238- {
239- // Launch browser or other action based on the site
240- process . WaitForExit ( ) ;
241- }
242- } ) ;
243-
244- Task( "PublishDocs" )
245- . IsDependentOn ( "BuildDocs" )
246- . WithCriteria ( ! string . IsNullOrEmpty ( gitHubPagesToken ) ) // && currentBranch.FriendlyName == "main")
247- . Does ( ( ) =>
248- {
249- // Get the current commit
250- var sourceCommit = currentBranch . Tip ;
251- var publishFolder = $ "./artifacts/docs-publish-{ DateTime . Now . ToString ( "yyyyMMdd_HHmmss" ) } ";
252- Information ( "Publishing Folder: {0}" , publishFolder ) ;
253- Information ( "Getting publish branch..." ) ;
254- GitClone ( "https://github.com/TrueLayer/truelayer-dotnet.git" ,
255- publishFolder ,
256- gitHubUser ,
257- gitHubPagesToken ,
258- new GitCloneSettings { BranchName = "gh-pages" }
259- ) ;
260-
261- Information ( "Sync output files..." ) ;
262-
263- Kudu . Sync ( sitePath , publishFolder , new KuduSyncSettings {
264- ArgumentCustomization = args => args . Append ( "--ignore" ) . AppendQuoted ( ".git;CNAME" )
265- } ) ;
266-
267- if ( GitHasUncommitedChanges ( publishFolder ) )
268- {
269- GitAddAll ( publishFolder ) ;
270- Information ( "Stage all changes..." ) ;
271-
272- // Only considers modified files - https://github.com/cake-contrib/Cake_Git/issues/77
273- if ( BuildContext . ForcePushDocs || GitHasStagedChanges ( publishFolder ) )
274- {
275- Information ( "Commit all changes..." ) ;
276- GitCommit (
277- publishFolder ,
278- sourceCommit . Committer . Name ,
279- sourceCommit . Committer . Email ,
280- string . Format ( "Continuous Integration Publish: {0}\r \n {1}" , sourceCommit . Sha , sourceCommit . Message )
281- ) ;
282-
283- Information ( "Pushing all changes..." ) ;
284-
285- GitPush ( publishFolder , gitHubUser , gitHubPagesToken , "gh-pages" ) ;
286- }
287- }
288- } ) ;
289-
290221Task( "Dump" ) . Does ( ( ) => BuildContext . PrintParameters ( Context ) ) ;
291222
292223Task( "Default" )
293224 . IsDependentOn ( "Clean" )
294225 . IsDependentOn ( "Build" )
295226 . IsDependentOn ( "Test" )
296227 . IsDependentOn ( "Pack" )
297- . IsDependentOn ( "GenerateReports" )
298- . IsDependentOn ( "BuildDocs" ) ;
228+ . IsDependentOn ( "GenerateReports" ) ;
299229
300230Task( "CI" )
301231 //.IsDependentOn("SonarBegin")
@@ -306,11 +236,9 @@ Task("CI")
306236Task( "Publish" )
307237 . IsDependentOn ( "CI" )
308238 . IsDependentOn ( "PublishPackages" ) ;
309- //.IsDependentOn("PublishDocs");
310239
311240RunTarget( target ) ;
312241
313-
314242public static class BuildContext
315243{
316244 public static bool IsTag { get ; private set ; }
0 commit comments