forked from SwedbankPay/swedbank-pay-sdk-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
58 lines (47 loc) · 1.72 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
var target = Argument("target", "Copy-And-Publish-Artifacts");
var configuration = Argument("configuration", "Release");
var proj = $"./src/SwedbankPay.Sdk/SwedbankPay.Sdk.csproj";
var version = "1.0.0";
var artifactsDir = MakeAbsolute(Directory("artifacts"));
var packagesDir = artifactsDir.Combine(Directory("packages"));
Task("Build")
.Does(() => {
DotNetCoreBuild(proj, new DotNetCoreBuildSettings { Configuration = "Release" });
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
Warning("Lacking tests.");
//var testproj = $"./src/SwedbankPay.Sdk/SwedbankPay.Sdk.csproj";
//DotNetCoreTest(testproj);
});
Task("Pack")
.IsDependentOn("Test")
.Does(() => {
var coresettings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = packagesDir,
};
coresettings.MSBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", new[] { version });
DotNetCorePack(proj, coresettings);
});
Task("Copy-And-Publish-Artifacts")
.IsDependentOn("Pack")
.Does(() =>
{
Information($"Uploading files from packagesDir directory: {packagesDir} to TFS");
TFBuild.Commands.UploadArtifactDirectory($"{packagesDir}");
});
Task("PublishToNugetOrg")
.IsDependentOn("Pack")
.Does(() => {
var settings = new DotNetCoreNuGetPushSettings
{
Source = "https://api.nuget.org/v3/index.json",
ApiKey = Argument("nugetapikey", "must-be-given")
};
DotNetCoreNuGetPush($"{packagesDir}/SwedbankPay.Sdk.{version}.nupkg", settings);
});
RunTarget(target);