-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
69 lines (55 loc) · 2.03 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
#addin nuget:?package=Cake.ArgumentHelpers
#addin nuget:?package=dotenv.net
using dotenv.net;
DotEnv.Config();
var target = Argument("target", "default");
var configuration = Argument("configuration", "Release");
var solution = File("SqlServerPath.sln");
var nugetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY");
var nugetSource = Environment.GetEnvironmentVariable("NUGET_SOURCE");
Task("clean")
.Description("Calls msbuild with 'Clean' target for the solution. Accepts 'configuration' => Debug|Release")
.Does(() =>
{
MSBuild(solution, settings => settings.SetConfiguration(configuration)
.UseToolVersion(MSBuildToolVersion.Default)
.WithTarget("Clean"));
});
Task("build")
.Description("Calls msbuild with 'Build' target for the solution. Accepts 'configuration' => Debug|Release")
.Does(() =>
{
MSBuild(solution, settings => settings.SetConfiguration(configuration)
.UseToolVersion(MSBuildToolVersion.Default)
.WithTarget("build"));
});
Task("rebuild")
.Description("Calls 'clean' then 'build'")
.IsDependentOn("clean")
.IsDependentOn("build");
Task("restore-nuget")
.Description("Restores NuGet packages")
.Does(() => NuGetRestore(solution));
Task("package-build")
.Description("Builds the NuGet package")
.IsDependentOn("restore-nuget")
.Does(() =>
{
MSBuild(solution, settings => settings.SetConfiguration("Release")
.UseToolVersion(MSBuildToolVersion.Default)
.WithTarget("pack"));
});
Task("package-push")
.Description("Pushes NuGet package to NuGet")
.Does(() =>
{
var version = XmlPeek("SqlServerPath/SqlServerPath.fsproj", "/Project/PropertyGroup/Version");
var package = $"./SqlServerPath/bin/Release/SqlServerPath.{version}.nupkg";
NuGetPush(package, new NuGetPushSettings {
Source = nugetSource,
ApiKey = nugetApiKey
});
});
Task("default")
.IsDependentOn("rebuild");
RunTarget(target);