|
1 | | -// Install .NET Core Global tools. |
2 | | -#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=6.5.1" |
3 | | - |
4 | | -#load "build/records.cake" |
5 | | -#load "build/helpers.cake" |
| 1 | +#:sdk Cake.Sdk@6.0.0 |
| 2 | +#:property IncludeAdditionalFiles=./build/*.cs |
6 | 3 |
|
7 | 4 | /***************************** |
8 | 5 | * Setup |
9 | 6 | *****************************/ |
10 | 7 | Setup( |
11 | 8 | static context => { |
| 9 | + InstallTool("dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=6.5.1"); |
| 10 | + InstallTool("dotnet:https://api.nuget.org/v3/index.json?package=DPI&version=2025.12.17.349"); |
12 | 11 |
|
13 | 12 | var assertedVersions = context.GitVersion(new GitVersionSettings |
14 | 13 | { |
15 | 14 | OutputType = GitVersionOutput.Json |
16 | 15 | }); |
17 | 16 |
|
18 | | - var gh = context.GitHubActions(); |
19 | 17 | var buildDate = DateTime.UtcNow; |
20 | | - var runNumber = gh.IsRunningOnGitHubActions |
21 | | - ? gh.Environment.Workflow.RunNumber |
| 18 | + var runNumber = GitHubActions.IsRunningOnGitHubActions |
| 19 | + ? GitHubActions.Environment.Workflow.RunNumber |
22 | 20 | : (short)((buildDate - buildDate.Date).TotalSeconds/3); |
23 | 21 | var version = FormattableString |
24 | 22 | .Invariant($"{buildDate:yyyy.M.d}.{runNumber}"); |
|
63 | 61 | .WithProperty("PackageProjectUrl", "https://github.com/devlead/Devlead.Console.Template") |
64 | 62 | .WithProperty("RepositoryUrl", "https://github.com/devlead/Devlead.Console.Template.git") |
65 | 63 | .WithProperty("RepositoryType", "git") |
66 | | - .WithProperty("ContinuousIntegrationBuild", gh.IsRunningOnGitHubActions ? "true" : "false") |
| 64 | + .WithProperty("ContinuousIntegrationBuild", GitHubActions.IsRunningOnGitHubActions ? "true" : "false") |
67 | 65 | .WithProperty("EmbedUntrackedSources", "true") |
68 | 66 | .WithProperty("PackageOutputPath", data.NuGetOutputPath.FullPath) |
69 | 67 | .WithProperty("BaseOutputPath", data.BinaryOutputPath.FullPath + "/") |
|
144 | 142 | .DeferOnError() |
145 | 143 | .Then("DPI") |
146 | 144 | .Does<BuildData>( |
147 | | - static (context, data) => context.DotNetTool( |
148 | | - "tool", |
149 | | - new DotNetToolSettings { |
150 | | - ArgumentCustomization = args => args |
151 | | - .Append("run") |
152 | | - .Append("dpi") |
153 | | - .Append("nuget") |
154 | | - .Append("--silent") |
155 | | - .AppendSwitchQuoted("--output", "table") |
156 | | - .Append( |
157 | | - ( |
158 | | - !string.IsNullOrWhiteSpace(context.EnvironmentVariable("NuGetReportSettings_SharedKey")) |
159 | | - && |
160 | | - !string.IsNullOrWhiteSpace(context.EnvironmentVariable("NuGetReportSettings_WorkspaceId")) |
161 | | - ) |
162 | | - ? "report" |
163 | | - : "analyze" |
164 | | - ) |
165 | | - .AppendSwitchQuoted("--buildversion", data.Version) |
166 | | - } |
| 145 | + static (context, data) => Command( |
| 146 | + ["dpi", "dpi.exe"], |
| 147 | + new ProcessArgumentBuilder() |
| 148 | + .Append("nuget") |
| 149 | + .Append("--silent") |
| 150 | + .AppendSwitchQuoted("--output", "table") |
| 151 | + .Append( |
| 152 | + ( |
| 153 | + !string.IsNullOrWhiteSpace(context.EnvironmentVariable("NuGetReportSettings_SharedKey")) |
| 154 | + && |
| 155 | + !string.IsNullOrWhiteSpace(context.EnvironmentVariable("NuGetReportSettings_WorkspaceId")) |
| 156 | + ) |
| 157 | + ? "report" |
| 158 | + : "analyze" |
| 159 | + ) |
| 160 | + .AppendSwitchQuoted("--buildversion", data.Version) |
167 | 161 | ) |
168 | 162 | ) |
169 | 163 | .Then("Pack") |
|
180 | 174 | .Then("Upload-Artifacts") |
181 | 175 | .WithCriteria(BuildSystem.IsRunningOnGitHubActions, nameof(BuildSystem.IsRunningOnGitHubActions)) |
182 | 176 | .Does<BuildData>( |
183 | | - static (context, data) => context |
184 | | - .GitHubActions() |
185 | | - .Commands |
186 | | - .UploadArtifact(data.ArtifactsPath, "artifacts") |
| 177 | + static (context, data) => GitHubActions |
| 178 | + .Commands |
| 179 | + .UploadArtifact(data.ArtifactsPath, "artifacts") |
187 | 180 | ) |
188 | 181 | .Then("Push-GitHub-Packages") |
189 | 182 | .WithCriteria<BuildData>( (context, data) => data.ShouldPushGitHubPackages()) |
|
0 commit comments