-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom.nuget.pack.cake
More file actions
63 lines (49 loc) · 1.47 KB
/
custom.nuget.pack.cake
File metadata and controls
63 lines (49 loc) · 1.47 KB
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
/*
* Generate NuGet packages from nuspec files
*/
#region Variables
// Directory where NuGet packages should be placed
var nugetDirectory = "./nupkg/";
// String used to locate nuspec files
var nuspecFileString = "./{0}/{0}.nuspec";
#endregion
#region Tasks
// Create Nuget Package
Task ("NugetPack")
.Does (() => {
if(!testPassed)
{
Error("Unit tests failed - Nuget package won't be generated");
return;
}
if(buildConfiguration == "debug")
{
Information("Nuget package will not be built in Debug mode");
return;
}
CreateDirectory (nugetDirectory);
foreach(var project in projectFiles)
{
Information($"Generating NuGet package package for {project.Key}");
var nuspecFile = string.Format(nuspecFileString, project.Key);
ReplaceRegexInFiles(nuspecFile, "AppVersionNumber", version);
ReplaceRegexInFiles(nuspecFile, "ReleaseNotesHere", releaseNotesText);
if(gitHash != "none")
{
ReplaceRegexInFiles(nuspecFile, "GitHashHere", gitHash);
}
NuGetPack (nuspecFile, GetNuGetPackSettings());
}
});
#endregion
#region Private Methods
// Generates the NuGetPackSettings
private NuGetPackSettings GetNuGetPackSettings()
{
return new NuGetPackSettings
{
Verbosity = NuGetVerbosity.Detailed,
OutputDirectory = nugetDirectory
};
}
#endregion