This repository has been archived by the owner on Dec 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.cake
84 lines (69 loc) · 2.13 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
80
81
82
83
84
#load "artifact.cake"
#load "changelog.cake"
#load "mstest2.cake"
#load "github.cake"
#addin Cake.Bumpy
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = "0.11.0";
RepositoryHome = "..";
var gitHubSettings = new GitHubSettings
{
Owner = "fwinkelbauer",
Repository = "Bumpy",
Token = EnvironmentVariable("GITHUB_RELEASE_TOKEN"),
GitTag = version,
TextBody = "More information about this release can be found in the [changelog](https://github.com/fwinkelbauer/Bumpy/blob/master/CHANGELOG.md)",
IsDraft = true,
IsPrerelease = false
};
Task("Clean").Does(() =>
{
CleanArtifacts();
CleanDirectories($"Bumpy*/bin/{configuration}");
CleanDirectory("TestResults");
});
Task("Restore").Does(() =>
{
NuGetRestore("Bumpy.sln");
});
Task("Build").Does(() =>
{
MSBuild("Bumpy.sln", new MSBuildSettings { Configuration = configuration, WarningsAsError = true });
StoreBuildArtifacts("Bumpy", $"Bumpy/bin/{configuration}/**/*");
});
Task("Test").Does(() =>
{
MSTest2_VS2017($"*.Tests/bin/{configuration}/*.Tests.dll");
});
Task("CreatePackages").Does(() =>
{
PackChocolateyArtifacts("NuSpec/Chocolatey/**/*.nuspec");
PackNuGetArtifacts("NuSpec/NuGet/**/*.nuspec");
});
Task("PushPackages").Does(() =>
{
BumpyEnsure();
EnsureChangelog("../CHANGELOG.md", version);
PublishChocolateyArtifact("Bumpy.Portable", "https://push.chocolatey.org/");
PublishNuGetArtifact("Bumpy", "https://www.nuget.org/api/v2/package");
var mime = "application/zip";
PublishGitHubReleaseWithArtifacts(
gitHubSettings,
new GitHubAsset(GetChocolateyArtifact("Bumpy.Portable"), mime),
new GitHubAsset(GetNuGetArtifact("Bumpy"), mime));
});
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("CreatePackages");
Task("Publish")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("CreatePackages")
.IsDependentOn("PushPackages");
RunTarget(target);