-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.cake
64 lines (53 loc) · 1.82 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
#addin Cake.Git
#tool GitVersion.CommandLine
var target = Argument("target", "Default");
var config = Argument("configuration", "Release");
var nugetKey = Argument<string>("nugetKey", null) ?? EnvironmentVariable("nuget_key");
var rootDir = Directory(".");
var srcDir = rootDir + Directory("src");
var libDir = srcDir + Directory("SoundpadConnector");
var pkgDir = libDir + Directory($"bin/{config}");
GitVersion semVer = null;
Task("SemVer").Does(() => {
semVer = GitVersion();
Information($"{semVer.FullSemVer}");
});
Task("Clean").Does(() =>
DotNetCoreClean(srcDir, new DotNetCoreCleanSettings {
Configuration = config,
Verbosity = DotNetCoreVerbosity.Minimal
}));
Task("Build").Does(() =>
DotNetCoreBuild(srcDir, new DotNetCoreBuildSettings {
Configuration = config
}));
Task("Pack")
.IsDependentOn("SemVer")
.Does(() => {
Information($"Packing {semVer.NuGetVersion}");
var msbuildSettings = new DotNetCoreMSBuildSettings();
msbuildSettings.Properties["PackageVersion"] = new[] { semVer.NuGetVersion };
DotNetCorePack(libDir, new DotNetCorePackSettings {
Configuration = config,
OutputDirectory = pkgDir,
NoBuild = true,
NoDependencies = false,
MSBuildSettings = msbuildSettings
});
});
Task("Release")
.IsDependentOn("Pack")
.Does(() => {
Information($"Releasing {semVer.NuGetVersion} to nuget.org");
DotNetCoreNuGetPush(
pkgDir + File($"SoundpadConnector.{semVer.NuGetVersion}.nupkg"),
new DotNetCoreNuGetPushSettings {
Source = "nuget.org",
ApiKey = nugetKey
});
});
Task("Default")
.IsDependentOn("SemVer")
.IsDependentOn("Clean")
.IsDependentOn("Build");
RunTarget(target);