-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.cake
78 lines (64 loc) · 1.92 KB
/
test.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
#reference "BuildArtifacts/temp/_PublishedLibraries/Cake.AppVeyor/net6.0/Cake.AppVeyor.dll"
#addin nuget:?package=Refit&version=4.8.14
#addin nuget:?package=Newtonsoft.Json&version=13.0.3
public class BuildData
{
public string AppVeyorApiToken { get; set; }
public string AccountName { get; set; }
public string ProjectSlug { get; set; }
public BuildData()
{
AccountName = "GaryEwanPark";
ProjectSlug = "resharperreports";
}
}
Setup<BuildData>(setupContext => {
return new BuildData()
{
AppVeyorApiToken = EnvironmentVariable<string>("APPVEYOR_API_TOKEN", "")
};
});
Task("Default")
.IsDependentOn("Get-Projects")
.IsDependentOn("Get-Environments")
.IsDependentOn("Clear-Cache");
Task("Get-Projects")
.Does<BuildData>((data) =>
{
if (string.IsNullOrEmpty(data.AppVeyorApiToken))
{
Error("Unable to find AppVeyor API Token");
return;
}
Information("Found the following projects:");
foreach(var project in AppVeyorProjects(data.AppVeyorApiToken))
{
Information("Name: {0}, Repository: {1}, Slug: {2}", project.Name, project.RepositoryName, project.Slug);
}
});
Task("Get-Environments")
.Does<BuildData>((data) =>
{
if (string.IsNullOrEmpty(data.AppVeyorApiToken))
{
Error("Unable to find AppVeyor API Token");
return;
}
Information("Found the following environments:");
foreach(var environment in AppVeyorEnvironments(data.AppVeyorApiToken))
{
Information("Name: {0}, Provider: {1}", environment.Name, environment.Provider);
}
});
Task("Clear-Cache")
.Does<BuildData>((data) =>
{
if (string.IsNullOrEmpty(data.AppVeyorApiToken))
{
Error("Unable to find AppVeyor API Token");
return;
}
Information("Clearing Project Cache...");
AppVeyorClearCache(data.AppVeyorApiToken, data.AccountName, data.ProjectSlug);
});
RunTarget("Default");