forked from spectresystems/spectre.cli
/
build.cake
57 lines (49 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
#load nuget:?package=Spectre.Build&version=0.3.0
#tool "nuget:https://api.nuget.org/v3/index.json?package=gitreleasemanager&version=0.7.1"
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Pack-NuGet")
.PartOf(SpectreTasks.Pack)
.Does<SpectreData>(data =>
{
DotNetCorePack("./src/Spectre.Cli/Spectre.Cli.csproj", new DotNetCorePackSettings {
Configuration = data.Configuration,
OutputDirectory = data.Paths.NuGetPackages,
NoRestore = true,
NoBuild = true,
MSBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", data.Version.SemanticVersion)
.WithProperty("AssemblyVersion", data.Version.MajorMinorPatchRevision)
.WithProperty("FileVersion", data.Version.MajorMinorPatchRevision)
.WithProperty("PackageVersion", data.Version.SemanticVersion)
});
});
///////////////////////////////////////////////////////////////////////////////
// UTILITIES
///////////////////////////////////////////////////////////////////////////////
Task("Create-Release")
.WithCriteria<SpectreData>((context, data) => data.CI.IsLocal, "Not running locally")
.Does<SpectreData>((context, data) =>
{
var username = context.Argument<string>("github-username", null);
var password = context.Argument<string>("github-password", null);
if (string.IsNullOrWhiteSpace(username) ||
string.IsNullOrWhiteSpace(password))
{
throw new InvalidOperationException("No GitHub credentials has been provided.");
}
context.GitReleaseManagerCreate(
username,
password,
"spectresystems", "spectre.cli",
new GitReleaseManagerCreateSettings {
Milestone = $"v{data.Version.MajorMinorPatch}",
Name = $"v{data.Version.MajorMinorPatch}",
TargetCommitish = "master"
});
});
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
Spectre.Build();