2020-05-21 22:50:38 +02:00
|
|
|
#addin Cake.DocFx&version=0.13.1
|
2020-05-21 23:28:24 +02:00
|
|
|
#tool docfx.console&version=2.51.0
|
2020-05-21 22:50:38 +02:00
|
|
|
|
2020-05-25 22:52:35 +02:00
|
|
|
// this is the upcoming version, for prereleases
|
|
|
|
var version = Argument("version", "3.3.3");
|
2020-05-21 22:50:38 +02:00
|
|
|
var target = Argument("target", "Default");
|
|
|
|
var branch = Argument("branch", "master");
|
|
|
|
var config = Argument("configuration", "Release");
|
|
|
|
|
|
|
|
Task("Prepare").Does(() => {
|
|
|
|
DotNetCoreRestore("MLEM.sln");
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
DeleteFiles("**/*.nupkg");
|
|
|
|
});
|
|
|
|
|
|
|
|
Task("Build").IsDependentOn("Prepare").Does(() =>{
|
|
|
|
var settings = new DotNetCoreBuildSettings {
|
|
|
|
Configuration = config,
|
|
|
|
ArgumentCustomization = args => args.Append($"/p:Version={version}")
|
|
|
|
};
|
|
|
|
foreach (var project in GetFiles("**/MLEM*.csproj"))
|
|
|
|
DotNetCoreBuild(project.FullPath, settings);
|
|
|
|
DotNetCoreBuild("Demos/Demos.csproj", settings);
|
|
|
|
});
|
|
|
|
|
|
|
|
Task("Pack").IsDependentOn("Build").Does(() => {
|
|
|
|
var settings = new DotNetCorePackSettings {
|
|
|
|
Configuration = config,
|
|
|
|
ArgumentCustomization = args => args.Append($"/p:Version={version}")
|
|
|
|
};
|
|
|
|
foreach (var project in GetFiles("**/MLEM*.csproj"))
|
|
|
|
DotNetCorePack(project.FullPath, settings);
|
|
|
|
});
|
|
|
|
|
2020-05-22 01:44:47 +02:00
|
|
|
Task("Push").WithCriteria(branch == "master" || 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 {
|
|
|
|
Source = "http://localhost:5000/v3/index.json",
|
|
|
|
ApiKey = EnvironmentVariable("BAGET")
|
|
|
|
};
|
|
|
|
}
|
2020-05-22 21:05:12 +02:00
|
|
|
settings.SkipDuplicate = true;
|
2020-05-21 22:50:38 +02:00
|
|
|
NuGetPush(GetFiles("**/*.nupkg"), settings);
|
|
|
|
});
|
|
|
|
|
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
|
|
|
|
|
|
|
RunTarget(target);
|