-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.cake
64 lines (55 loc) · 1.45 KB
/
build.cake
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
var target = Argument("target", "Default");
var outputDir = "./bin";
Task("Default")
.IsDependentOn("Test");
Task("Test")
.IsDependentOn("Build")
.Does(()=>
{
DotNetCoreTest("./src/FibonacciHeap.Tests/FibonacciHeap.Tests.csproj");
});
Task("Build")
.IsDependentOn("NugetRestore")
.Does(()=>
{
var settings = new DotNetCoreBuildSettings{Configuration = "Release"};
DotNetCoreBuild("FibonacciHeap.sln", settings);
});
Task("NugetRestore")
.IsDependentOn("Clean")
.Does(()=>
{
DotNetCoreRestore();
});
Task("Publish-NuGet")
.IsDependentOn("Build")
.Does(() =>
{
// Resolve the API key.
var apiKey = EnvironmentVariable("NUGET_API_KEY");
if(string.IsNullOrEmpty(apiKey)) {
throw new InvalidOperationException("Could not resolve NuGet API key.");
}
// Resolve the API url.
var apiUrl = EnvironmentVariable("NUGET_API_URL");
if(string.IsNullOrEmpty(apiUrl)) {
throw new InvalidOperationException("Could not resolve NuGet API url.");
}
var packagePath = GetFiles("./src/FibonacciHeap/bin/Release/FibonacciHeap.*.nupkg")
.Single()
.FullPath;
Information($"Publish {packagePath}");
// Push the package.
NuGetPush(packagePath, new NuGetPushSettings {
ApiKey = apiKey,
Source = apiUrl
});
});
Task("Clean")
.Does(()=>
{
CleanDirectories("**/bin/**");
CleanDirectories("**/obj/**");
CleanDirectories("nupkgs");
});
RunTarget(target);