-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.cake
108 lines (92 loc) · 2.6 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
#addin nuget:?package=Cake.FileHelpers&version=4.0.1
#tool nuget:?package=NuGet.CommandLine&version=5.9.1
var target = Argument("target", "Build");
var configuration = Argument("configuration", "Release");
var artifactDirPath = "./artifacts/";
var packagePublishDirPath = "./publish/";
Setup(ctx=>
{
SetUpNuget();
});
void SetUpNuget()
{
var feed = new
{
Name = "SkynetNuget",
Source = "https://skynetcode.pkgs.visualstudio.com/_packaging/skynetpackagefeed/nuget/v3/index.json"
};
if (!NuGetHasSource(source:feed.Source))
{
var nugetSourceSettings = new NuGetSourcesSettings
{
UserName = "blah",
Password = EnvironmentVariable("SYSTEM_ACCESSTOKEN"),
Verbosity = NuGetVerbosity.Detailed
};
NuGetAddSource(
name:feed.Name,
source:feed.Source,
settings:nugetSourceSettings);
}
}
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Build")
.Does(() =>
{
DotNetCoreBuild("./src/DtoGenerators/DtoGenerators.csproj", new DotNetCoreBuildSettings
{
Configuration = configuration,
});
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
// DotNetCoreTest("./SourceGenerators.sln", new DotNetCoreTestSettings
// {
// Configuration = configuration,
// NoBuild = true,
// });
});
Task("PushToNuget")
.IsDependentOn("Pack")
.Does(()=>
{
PushToNugetFeed(
"https://skynetcode.pkgs.visualstudio.com/_packaging/skynetpackagefeed/nuget/v3/index.json",
"gibberish");
});
void PushToNugetFeed(string source, string apiKey)
{
var files = GetFiles($"{artifactDirPath}DtoGenerators.*.nupkg");
foreach(var file in files)
{
Information(file.FullPath);
var settings = new DotNetCoreNuGetPushSettings
{
Source = source,
ApiKey = apiKey,
SkipDuplicate = true
};
DotNetCoreNuGetPush(file.FullPath, settings);
}
}
Task("Pack")
.IsDependentOn("Test")
.Does(()=>{
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = artifactDirPath,
NoBuild = true,
NoRestore = true
};
DotNetCorePack("./src/DtoGenerators/DtoGenerators.csproj",
settings);
});
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);