forked from arturcic/KeycloakClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
117 lines (96 loc) · 3.4 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Install modules
#module nuget:?package=Cake.DotNetTool.Module&version=0.3.0
// Install addins.
#addin "nuget:?package=Newtonsoft.Json&version=11.0.2"
#addin "nuget:?package=Cake.Codecov&version=0.7.0"
#addin "nuget:?package=Cake.Coverlet&version=2.3.4"
#addin "nuget:?package=Cake.Docker&version=0.10.1"
#addin "nuget:?package=Cake.Incubator&version=5.1.0"
#addin "nuget:?package=Cake.Http&version=0.7.0"
#tool "nuget:?package=nuget.commandline&version=5.2.0"
// Install .NET Core Global tools.
#tool "dotnet:?package=Codecov.Tool&version=1.7.2"
#tool "dotnet:?package=GitVersion.Tool&version=5.0.1"
#tool "dotnet:?package=GitReleaseManager.Tool&version=0.8.0"
// Load other scripts.
#load "./build/utils/parameters.cake"
#load "./build/utils/utils.cake"
#load "./build/tasks.cake"
//////////////////////////////////////////////////////////////////////
// PARAMETERS
//////////////////////////////////////////////////////////////////////
bool publishingError = false;
bool singleStageRun = true;
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup<BuildParameters>(context =>
{
EnsureDirectoryExists("artifacts");
var parameters = BuildParameters.GetParameters(context);
var gitVersion = GetVersion(parameters);
parameters.Initialize(context, gitVersion);
// Increase verbosity?
if (parameters.IsMainBranch && (context.Log.Verbosity != Verbosity.Diagnostic)) {
Information("Increasing verbosity to diagnostic.");
context.Log.Verbosity = Verbosity.Diagnostic;
}
Information("Building version {0} of KeycloakClient ({1}, {2})",
parameters.Version.SemVersion,
parameters.Configuration,
parameters.Target);
Information("Repository info : IsMainRepo {0}, IsMainBranch {1}, IsTagged: {2}, IsPullRequest: {3}",
parameters.IsMainRepo,
parameters.IsMainBranch,
parameters.IsTagged,
parameters.IsPullRequest);
return parameters;
});
Teardown<BuildParameters>((context, parameters) =>
{
try
{
Information("Starting Teardown...");
Information("Repository info : IsMainRepo {0}, IsMainBranch {1}, IsTagged: {2}, IsPullRequest: {3}",
parameters.IsMainRepo,
parameters.IsMainBranch,
parameters.IsTagged,
parameters.IsPullRequest);
Information("Finished running tasks.");
}
catch (Exception exception)
{
Error(exception.Dump());
}
});
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Pack")
.IsDependentOn("Pack-Nuget")
.IsDependentOn("Publish-Coverage")
.Finally(() =>
{
});
Task("Publish")
.IsDependentOn("Publish-AzurePipeline")
.IsDependentOn("Publish-NuGet")
.Finally(() =>
{
if (publishingError)
{
throw new Exception("An error occurred during the publishing of KeycloakClient. All publishing tasks have been attempted.");
}
});
Task("Release")
.IsDependentOn("Release-Notes")
.Finally(() =>
{
});
Task("Default")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
RunTarget(target);