forked from asynkron/protoactor-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
79 lines (72 loc) · 2.21 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#addin Cake.Git
var packageVersion = "0.1.9";
var target = Argument("target", "Default");
var mygetApiKey = Argument<string>("mygetApiKey", null);
var currentBranch = Argument<string>("currentBranch", GitBranchCurrent("./").FriendlyName);
var buildNumber = Argument<string>("buildNumber", null);
var configuration = "Release";
var versionSuffix = "";
if (currentBranch != "master") {
versionSuffix += "-" + currentBranch;
if (buildNumber != null) {
versionSuffix += "-build" + buildNumber.PadLeft(5, '0');
}
packageVersion += versionSuffix;
}
Information("Version: " + packageVersion);
Task("PatchVersion")
.Does(() => {
foreach(var proj in GetFiles("src/**/*.csproj")) {
Information("Patching " + proj);
XmlPoke(proj, "/Project/PropertyGroup/Version", packageVersion);
}
});
Task("Restore")
.IsDependentOn("PatchVersion")
.Does(() => {
DotNetCoreRestore();
});
Task("Build")
.IsDependentOn("Restore")
.Does(() => {
DotNetCoreBuild("ProtoActor.sln", new DotNetCoreBuildSettings {
Configuration = configuration,
});
});
Task("UnitTest")
.Does(() => {
foreach(var proj in GetFiles("tests/**/*.Tests.csproj")) {
DotNetCoreTest(proj.ToString(), new DotNetCoreTestSettings {
NoBuild = true,
Configuration = configuration
});
}
});
Task("Pack")
.Does(() => {
foreach(var proj in GetFiles("src/**/*.csproj")) {
DotNetCorePack(proj.ToString(), new DotNetCorePackSettings {
OutputDirectory = "out",
Configuration = configuration,
NoBuild = true,
});
}
});
Task("Push")
.Does(() => {
var pkgs = GetFiles("out/*.nupkg");
foreach(var pkg in pkgs) {
NuGetPush(pkg, new NuGetPushSettings {
Source = "https://www.myget.org/F/protoactor/api/v2/package",
ApiKey = mygetApiKey
});
}
});
Task("Default")
.IsDependentOn("Restore")
.IsDependentOn("PatchVersion")
.IsDependentOn("Build")
.IsDependentOn("UnitTest")
.IsDependentOn("Pack")
;
RunTarget(target);