forked from Dalmirog-zz/OctoPosh
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWebsite_Build.cake
79 lines (62 loc) · 2.53 KB
/
Website_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
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
#addin "Cake.Powershell"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Debug");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
//The compiled Website will be sent to publishDir. The Webjovs will be sent to publishDir + Path of the web job.
var publishDir = Directory("./Octoposh.Web/Publish/");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(publishDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
Information("Running dotnet restore for DownloadsTracker.csproj...");
DotNetCoreRestore("DownloadsTracker/DownloadsTracker.csproj");
Information("Running dotnet restore for Octoposh.Web.csproj...");
DotNetCoreRestore("Octoposh.Web/Octoposh.Web.csproj");
});
Task("Build and Publish")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
//Build website
var webSiteSettings = new DotNetCorePublishSettings
{
Framework = "netcoreapp2.0",
Configuration = "Release",
OutputDirectory = publishDir
};
//Build downloadsTracker webJob
var downloadsTrackerJobSettings = new DotNetCorePublishSettings
{
Framework = "netcoreapp2.0",
Configuration = "Release",
OutputDirectory = Directory(publishDir + Directory("App_Data/jobs/triggered/DownloadsTracker"))
};
Information("Running dotnet publish for DownloadsTracker.csproj...");
DotNetCorePublish("./Octoposh.Web/Octoposh.Web.csproj", webSiteSettings);
Information("Running dotnet publish for Octoposh.Web.csproj...");
DotNetCorePublish("./DownloadsTracker/DownloadsTracker.csproj", downloadsTrackerJobSettings);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build and Publish");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);