2021-04-22 19:59:35 +02:00
|
|
|
#addin Cake.DocFx&version=1.0.0
|
2022-12-12 10:28:43 +01:00
|
|
|
#tool docfx.console&version=2.59.4
|
2020-05-21 22:50:38 +02:00
|
|
|
|
2020-05-25 22:52:35 +02:00
|
|
|
// this is the upcoming version, for prereleases
|
2022-07-25 18:56:21 +02:00
|
|
|
var version = Argument("version", "6.1.0");
|
2020-05-21 22:50:38 +02:00
|
|
|
var target = Argument("target", "Default");
|
2020-11-07 00:52:04 +01:00
|
|
|
var branch = Argument("branch", "main");
|
2020-05-21 22:50:38 +02:00
|
|
|
var config = Argument("configuration", "Release");
|
|
|
|
|
|
|
|
Task("Prepare").Does(() => {
|
2022-09-14 22:00:45 +02:00
|
|
|
DotNetRestore("MLEM.sln");
|
|
|
|
DotNetRestore("MLEM.FNA.sln");
|
2022-06-24 14:01:26 +02:00
|
|
|
|
2020-05-21 22:50:38 +02:00
|
|
|
if (branch != "release") {
|
|
|
|
var buildNum = EnvironmentVariable("BUILD_NUMBER");
|
|
|
|
if (buildNum != null)
|
2020-05-21 22:59:15 +02:00
|
|
|
version += "-" + buildNum;
|
2020-05-21 22:50:38 +02:00
|
|
|
}
|
2022-06-24 14:01:26 +02:00
|
|
|
|
2022-09-09 17:55:14 +02:00
|
|
|
DeleteFiles("**/MLEM*.nupkg");
|
2020-05-21 22:50:38 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Task("Build").IsDependentOn("Prepare").Does(() =>{
|
2022-09-14 22:00:45 +02:00
|
|
|
var settings = new DotNetBuildSettings {
|
2020-05-21 22:50:38 +02:00
|
|
|
Configuration = config,
|
|
|
|
ArgumentCustomization = args => args.Append($"/p:Version={version}")
|
|
|
|
};
|
2022-09-14 22:00:45 +02:00
|
|
|
DotNetBuild("MLEM.sln", settings);
|
|
|
|
DotNetBuild("MLEM.FNA.sln", settings);
|
2020-05-21 22:50:38 +02:00
|
|
|
});
|
|
|
|
|
2021-03-18 17:28:08 +01:00
|
|
|
Task("Test").IsDependentOn("Build").Does(() => {
|
2022-09-14 22:00:45 +02:00
|
|
|
var settings = new DotNetTestSettings {
|
2021-03-18 17:28:08 +01:00
|
|
|
Configuration = config,
|
|
|
|
Collectors = {"XPlat Code Coverage"}
|
2022-06-24 14:01:26 +02:00
|
|
|
};
|
2022-09-14 23:44:07 +02:00
|
|
|
DotNetTest("MLEM.sln", settings);
|
|
|
|
DotNetTest("MLEM.FNA.sln", settings);
|
2021-03-18 17:28:08 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
Task("Pack").IsDependentOn("Test").Does(() => {
|
2022-09-14 22:00:45 +02:00
|
|
|
var settings = new DotNetPackSettings {
|
2020-05-21 22:50:38 +02:00
|
|
|
Configuration = config,
|
|
|
|
ArgumentCustomization = args => args.Append($"/p:Version={version}")
|
|
|
|
};
|
2022-09-15 10:44:50 +02:00
|
|
|
DotNetPack("MLEM.sln", settings);
|
|
|
|
DotNetPack("MLEM.FNA.sln", settings);
|
2020-05-21 22:50:38 +02:00
|
|
|
});
|
|
|
|
|
2020-11-07 00:52:04 +01:00
|
|
|
Task("Push").WithCriteria(branch == "main" || branch == "release").IsDependentOn("Pack").Does(() => {
|
2020-05-21 22:50:38 +02:00
|
|
|
NuGetPushSettings settings;
|
|
|
|
if (branch == "release") {
|
|
|
|
settings = new NuGetPushSettings {
|
|
|
|
Source = "https://api.nuget.org/v3/index.json",
|
|
|
|
ApiKey = EnvironmentVariable("NUGET")
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
settings = new NuGetPushSettings {
|
2022-10-15 14:04:45 +02:00
|
|
|
Source = "https://nuget.ellpeck.de/v3/index.json",
|
2020-05-21 22:50:38 +02:00
|
|
|
ApiKey = EnvironmentVariable("BAGET")
|
|
|
|
};
|
|
|
|
}
|
2020-05-22 21:05:12 +02:00
|
|
|
settings.SkipDuplicate = true;
|
2022-09-09 17:55:14 +02:00
|
|
|
NuGetPush(GetFiles("**/MLEM*.nupkg"), settings);
|
2020-05-21 22:50:38 +02:00
|
|
|
});
|
|
|
|
|
2020-05-21 23:19:16 +02:00
|
|
|
Task("Document").Does(() => {
|
|
|
|
var path = "Docs/docfx.json";
|
|
|
|
DocFxMetadata(path);
|
|
|
|
DocFxBuild(path);
|
|
|
|
});
|
2020-05-21 22:50:38 +02:00
|
|
|
|
|
|
|
Task("Default").IsDependentOn("Pack");
|
2020-05-22 01:44:47 +02:00
|
|
|
Task("Publish").IsDependentOn("Push");
|
2020-05-21 22:50:38 +02:00
|
|
|
|
2022-06-24 14:01:26 +02:00
|
|
|
RunTarget(target);
|