Repository navigation
Expand file tree
/
Copy pathbuild.cake
More file actions
107 lines (94 loc) · 2.88 KB
/
Copy pathbuild.cake
File metadata and controls
107 lines (94 loc) · 2.88 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
var target = Argument("target", "Test");
var configuration = Argument("configuration", "Release");
var semanticVersion = Argument("semanticversion", "0.0.0-local");
var buildVersion = semanticVersion.Split(new char[] { '-' }).FirstOrDefault() ?? semanticVersion;
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories($"./modules/**/bin/{configuration}", new CleanDirectorySettings()
{
Force = true
});
});
Task("Build")
.IsDependentOn("Clean")
.Does(context =>
{
context.Information("Build version: {0}", semanticVersion);
DotNetBuild("./CleanArchitectureToolkit.slnx", new DotNetBuildSettings
{
Configuration = configuration,
NoIncremental = true,
MSBuildSettings = new DotNetMSBuildSettings
{
Version = buildVersion,
AssemblyVersion = buildVersion,
FileVersion = buildVersion
}
});
});
Task("Test")
.IsDependentOn("Build")
.Does(context =>
{
var settings = new DotNetTestSettings
{
Configuration = "Release",
NoBuild = true
};
var projectFiles = GetFiles("./tests/**/*.Tests.csproj")
.Concat(GetFiles("./demo/**/*.Tests.csproj"));
foreach (var file in projectFiles)
{
context.Information("Testing {0}", file.FullPath);
DotNetTest(file.FullPath, settings);
}
});
Task("Pack")
.IsDependentOn("Test")
.Does(context =>
{
CleanDirectory("./artifacts/");
var settings = new DotNetPackSettings
{
Configuration = "Release",
OutputDirectory = "./artifacts/",
NoBuild = true,
MSBuildSettings = new DotNetMSBuildSettings
{
PackageVersion = semanticVersion
}
};
var projectFiles = GetFiles("./modules/**/*.csproj");
foreach (var file in projectFiles)
{
context.Information("Packing {0}", file.FullPath);
DotNetPack(file.FullPath, settings);
}
});
Task("Publish")
.IsDependentOn("Pack")
.Does(context =>
{
var apiKey = context.EnvironmentVariable("NUGET_API_KEY");
if (string.IsNullOrWhiteSpace(apiKey)) {
throw new CakeException("No NuGet API key specified.");
}
var nugetFiles = GetFiles("./artifacts/*.nupkg");
foreach (var file in nugetFiles)
{
context.Information("Publishing {0}", file.FullPath);
DotNetNuGetPush(file.FullPath, new DotNetNuGetPushSettings {
Source = "https://api.nuget.org/v3/index.json",
ApiKey = apiKey,
SkipDuplicate = true
});
}
});
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);