-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
41 lines (34 loc) · 1.24 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
#addin "wk.StartProcess"
#addin "wk.ProjectParser"
using PS = StartProcess.Processor;
using ProjectParser;
var nugetToken = EnvironmentVariable("npi");
var name = "DotNetRelease.Console";
var currentDir = new DirectoryInfo(".").FullName;
var info = Parser.Parse($"src/{name}/{name}.fsproj");
var publishDir = ".publish";
Task("Pack").Does(() => {
CleanDirectory(publishDir);
DotNetCorePack($"src/{name}", new DotNetCorePackSettings {
OutputDirectory = publishDir
});
});
Task("Publish-NuGet")
.IsDependentOn("Pack")
.Does(() => {
var nupkg = new DirectoryInfo(publishDir).GetFiles("*.nupkg").LastOrDefault();
var package = nupkg.FullName;
NuGetPush(package, new NuGetPushSettings {
Source = "https://www.nuget.org/api/v2/package",
ApiKey = nugetToken
});
});
Task("Install")
.IsDependentOn("Pack")
.Does(() => {
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
PS.StartProcess($"dotnet tool uninstall -g {info.PackageId}");
PS.StartProcess($"dotnet tool install -g {info.PackageId} --add-source {currentDir}/{publishDir} --version {info.Version}");
});
var target = Argument("target", "Pack");
RunTarget(target);