This repository has been archived by the owner on Aug 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.cake
55 lines (48 loc) · 1.43 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
// Variables
var solution = "./src/OCore/OCore.sln";
var buildConfiguration = "Release";
var packageOutputDir = "./packages/";
var target = Argument("target", "Build");
var apiKey = EnvironmentVariable("OCORE_NUGET_API_KEY");
Task("Build")
.Does(() => {
var settings = new DotNetCoreBuildSettings
{
Configuration = buildConfiguration,
};
DotNetCoreBuild(solution, settings);
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
Information("Running tests");
});
Task("Pack")
.IsDependentOn("Test")
.Does(() => {
if (DirectoryExists(packageOutputDir)) {
DeleteDirectory(packageOutputDir, new DeleteDirectorySettings {
Recursive = true,
Force = true,
});
}
DotNetCorePack(solution, new DotNetCorePackSettings
{
Configuration = buildConfiguration,
OutputDirectory = packageOutputDir,
});
});
Task("Push")
.IsDependentOn("Test")
.IsDependentOn("Pack")
.Does(() => {
var packageFiles = GetFiles(packageOutputDir + "*.nupkg");
foreach (var packageFile in packageFiles) {
NuGetPush(packageFile, new NuGetPushSettings {
ApiKey = apiKey,
Source = "https://api.nuget.org/v3/index.json",
SkipDuplicate = true
});
}
});
RunTarget(target);