-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtasks.ps1
89 lines (77 loc) · 1.94 KB
/
tasks.ps1
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
$script:config = "Release"
task Clean{
Clean-Folder $artifactsPath
Clean-Folder TestResults
Get-ProjectsForTask "Clean" | ForEach-Object {
Clean-Folder "$($_.Name)\bin"
}
New-Item $artifactsPath -Type directory -Force | Out-Null
}
task Compile {
Get-ProjectsForTask "Compile" | ForEach-Object {
Compile-Project $_.Name
}
Get-ProjectsForTask "Compile" |
Where { $_.Type -eq "EmbeddedWebJob" -or $_.Type -eq "StandaloneWebJob"} |
ForEach-Object {
Move-WebJob $_.Name $_.Config["Target"] $_.Config["RunMode"]
}
}
task Test{
Get-ProjectsForTask "Test" |
Where { $_.Type -eq "VsTest"} |
ForEach-Object {
Execute-VsTest $_.Name
}
Get-ProjectsForTask "Test" |
Where { $_.Type -eq "XUnit"} |
ForEach-Object {
Execute-XUnit $_.Name
}
Get-ProjectsForTask "Test" |
Where { $_.Type -eq "VsTestAndXUnit"} |
ForEach-Object {
Execute-VsTest $_.Name
Execute-XUnit $_.Name
}
}
task Pack{
Get-ProjectsForTask "Pack" | ForEach-Object {
if($_.Type -eq "Package"){
Pack-Project $_.Name
} else{
OctoPack-Project $_.Name
}
}
}
task Push{
Get-ProjectsForTask "Push" |
Where { $_.Type -eq "Package" -Or $_.Type -eq "AppPackage"} |
ForEach-Object{
Push-Package $_.Name $env:ylp_nugetPackageSource $env:ylp_nugetPackageSourceApiKey "409"
}
Get-ProjectsForTask "Push" |
Where { $_.Type -ne "Package"} |
ForEach-Object{
Push-Package $_.Name $env:ylp_octopusDeployPackageSource $env:ylp_octopusDeployApiKey "409"
}
}
task Release{
Get-ProjectsForTask "Release" | ForEach-Object {
Octo-CreateRelease $_.Name
}
}
task Deploy {
$branch = Get-CurrentBranch
$isGeneralRelease = Is-GeneralRelease $branch
$isLocalBuild = Is-LocalBuild
if($isGeneralRelease -or $isLocalBuild){
Get-ProjectsForTask "Deploy" | ForEach-Object {
Octo-DeployRelease $_.Name
}
} else{
"Skipped deployment: this is a prerelease version"
}
}
task dev Clean, Compile, Test, Pack
task ci dev, Push, Release, Deploy