-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.cake
111 lines (87 loc) · 3.07 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
#addin "nuget:?package=Cake.Incubator&version=3.0.0"
#addin "nuget:?package=Markdown&version=2.2.1"
#tool "nuget:?package=GitVersion.CommandLine"
#addin "Cake.FileHelpers"
#addin "Cake.Npm"
#addin "Cake.ArgumentHelpers"
var target = Argument("target", "Publish Docker");
var solution = "QuartzApi.Core.sln";
var version = GitVersion().FullSemVer;
var mark = new HeyRed.MarkdownSharp.Markdown();
var nugetSource = ArgumentOrEnvironmentVariable("NUGET_FEED", "https://api.nuget.org/v3/index.json");
var nugetApiKey = ArgumentOrEnvironmentVariable("NUGET_API_KEY","");
var mainProjectDirectory = "src/QuartzApiCore.API/";
var assetsDirectory = $"{mainProjectDirectory}/wwwroot";
Information($"Using version {version}");
var nugetPublishDirectory = "artifacts";
Task("Npm Install")
.Does(()=>{
var settings = new NpmInstallSettings{
WorkingDirectory = assetsDirectory
};
NpmInstall(settings);
});
Task("Parcel")
.IsDependentOn("Npm Install")
.Does(()=>{
var settings = new NpmRunScriptSettings {
WorkingDirectory = assetsDirectory,
ScriptName = "build"
};
NpmRunScript(settings);
});
Task("Build").Does(()=>{
DotNetCoreBuild(solution, new DotNetCoreBuildSettings(){
MSBuildSettings = new DotNetCoreMSBuildSettings().SetVersion(version)
});
});
Task("Test").IsDependentOn("Build").Does(()=>{
var testProjects = GetFiles("./tests/**/*.csproj");
foreach(var testProject in testProjects) {
DotNetCoreTest(testProject.FullPath);
}
});
Task("Pack")
.IsDependentOn("Parcel")
.IsDependentOn("Test").Does(()=>{
// var projectFile = GetFile("src/QuartzApiCore.API/*.csproj");
var readMeMd = FileReadText("README.md");
var readMe = mark.Transform(readMeMd);
var summary = FileReadText("nuget-summary.txt");
Information(summary);
var nugetPackSettings = new NuGetPackSettings{
Id = "Quartz.Admin.Core",
Title = "Quartz Admin Core",
Version = version,
OutputDirectory = nugetPublishDirectory,
Summary = summary,
Authors = new[] {"Roberto Yudice"},
Files = new [] { new NuSpecContent(){
Exclude = "src/QuartzApiCore.API/wwwroot/**"
} }
// Description = summary
};
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = nugetPublishDirectory,
NoBuild = false,
MSBuildSettings = new DotNetCoreMSBuildSettings().SetVersion(version)
.WithProperty("PackageDescription",summary)
.WithProperty("PackageId","QuartzAdmin")
.WithProperty("Authors","Roberto Yudice")
};
DotNetCorePack("src/QuartzApiCore.API/QuartzApiCore.API.csproj",settings);
// NuGetPack("src/QuartzApiCore.API/QuartzApiCore.API.csproj", nugetPackSettings);
});
Task("Push")
.IsDependentOn("Pack")
.Does(()=>{
var package = GetFiles(nugetPublishDirectory + "/*.nupkg");
NuGetPush( package, new NuGetPushSettings{
Source = nugetSource,
ApiKey = nugetApiKey
});
Information("Package pushed");
});
RunTarget(target);