-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cake
More file actions
88 lines (78 loc) · 2.08 KB
/
build.cake
File metadata and controls
88 lines (78 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Task("Clean")
.Does(() =>
{
CleanDirectory($"./src/GitIssue/.output/");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetBuild("./src/GitIssue.sln", new DotNetBuildSettings
{
Configuration = configuration,
});
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
DotNetTest("./src/GitIssue.sln", new DotNetTestSettings
{
Configuration = configuration,
NoBuild = true,
});
});
Task("Publish")
.IsDependentOn("Test")
.Does(() =>
{
DotNetPublish("src/GitIssue.Tool/GitIssue.Tool.csproj", new DotNetPublishSettings
{
Framework = "net6.0",
Runtime = "win10-x64",
PublishReadyToRun = false,
PublishTrimmed = false,
SelfContained = true,
PublishSingleFile = false,
Configuration = "Release",
OutputDirectory = "./.publish/"
});
});
Task("Package")
.IsDependentOn("Build")
.Does(() =>
{
DotNetPack("src/GitIssue.sln", new DotNetPackSettings
{
Configuration = "Release",
OutputDirectory = "./.packages/",
NoBuild = true,
});
});
Task("Push")
.IsDependentOn("Package")
.Does(() =>
{
// Make sure that there is an API key.
var apiKey = EnvironmentVariable("NUGET_API_KEY");
if (string.IsNullOrWhiteSpace(apiKey)) {
throw new CakeException("No NuGet API key specified.");
}
foreach(var file in GetFiles("./.packages/*.nupkg"))
{
Information("Publishing {0}...", file.FullPath);
NuGetPush(file, new NuGetPushSettings {
ApiKey = apiKey,
Source = "https://api.nuget.org/v3/index.json"
});
}
});
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Package")
.IsDependentOn("Publish");
RunTarget(target);