-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.cake
114 lines (95 loc) · 3.25 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
109
110
111
112
113
114
#module nuget:?package=Cake.DotNetTool.Module&version=0.2.0
#tool dotnet:?package=GitVersion.Tool&version=5.0.0-beta2-75
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var assemblyVersion = "1.0.0";
var packageVersion = "1.0.0";
var artifactsDir = MakeAbsolute(Directory("artifacts"));
var packagesDir = artifactsDir.Combine(Directory("packages"));
var solutionPath = "./Smi.NetCore.Extensions.sln";
Task("Clean")
.Does(() =>
{
CleanDirectory(artifactsDir);
var settings = new DotNetCoreCleanSettings
{
Configuration = configuration
};
DotNetCoreClean(solutionPath, settings);
});
Task("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore();
});
Task("SemanticVersion")
.IsDependentOn("Restore")
.Does(() =>
{
var gitVersionSettings = new GitVersionSettings
{
NoFetch = true,
};
var gitVersion = GitVersion(gitVersionSettings);
assemblyVersion = gitVersion.AssemblySemVer;
packageVersion = gitVersion.NuGetVersion;
Information($"AssemblySemVer: {assemblyVersion}");
Information($"NuGetVersion: {packageVersion}");
});
Task("SetAppVeyorVersion")
.IsDependentOn("SemanticVersion")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
// AppVeyor.UpdateBuildVersion(packageVersion);
});
Task("Build")
.IsDependentOn("SetAppVeyorVersion")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration,
NoIncremental = true,
NoRestore = true,
MSBuildSettings = new DotNetCoreMSBuildSettings()
.SetVersion(assemblyVersion)
.WithProperty("FileVersion", packageVersion)
.WithProperty("InformationalVersion", packageVersion)
.WithProperty("nowarn", "7035;1591")
};
DotNetCoreBuild(solutionPath, settings);
});
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
NoBuild = true,
NoRestore = true,
OutputDirectory = packagesDir,
IncludeSource = true,
IncludeSymbols = true,
MSBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("PackageVersion", packageVersion)
.WithProperty("Copyright", $"Copyright Sudhanshu Mishra {DateTime.Now.Year}")
};
DotNetCorePack("./Hosting/Hosting.csproj", settings);
DotNetCorePack("./Hosting.Lifetime/Hosting.Lifetime.csproj", settings);
});
Task("PublishAppVeyorArtifacts")
.IsDependentOn("Pack")
.WithCriteria(() => HasArgument("pack") && AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
CopyFiles($"{packagesDir}/*.nupkg", MakeAbsolute(Directory("./")), false);
GetFiles($"./*.nupkg")
.ToList()
.ForEach(f => AppVeyor.UploadArtifact(f, new AppVeyorUploadArtifactsSettings { DeploymentName = "packages" }));
});
Task("Default")
.IsDependentOn("PublishAppVeyorArtifacts");
RunTarget(target);