-
Notifications
You must be signed in to change notification settings - Fork 2
/
CommonTasks.PSDeploy.ps1
48 lines (47 loc) · 1.67 KB
/
CommonTasks.PSDeploy.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
if ($env:BHBuildSystem -eq 'AppVeyor' -and $env:BHBranchName -eq "master") {
Deploy Module {
By PSGalleryModule {
FromSource "$($env:BHBuildOutput)\Modules\$($env:BHProjectName)"
To PSGallery
WithOptions @{
ApiKey = $env:NugetApiKey
Force = $true
}
}
}
}
elseif ($env:BUILD_REPOSITORY_PROVIDER -eq 'TfsGit' -and $env:BUILD_SOURCEBRANCHNAME -eq "master") {
Deploy Module {
By PSGalleryModule {
FromSource "$($env:AGENT_RELEASEDIRECTORY)\$($env:BUILD_DEFINITIONNAME)\SourcesDirectory\BuildOutput\Modules\$($env:BUILD_REPOSITORY_NAME)"
To PowerShell
WithOptions @{
ApiKey = '[email protected]:Somepass1'
Force = $true
}
}
}
}
else {
$modulePath = if ($env:BHProjectPath -and $env:BHProjectName) {
$(Join-Path -Path $env:BHProjectPath -ChildPath $env:BHProjectName)
}
"Skipping deployment: To deploy, ensure that...`n" +
"`t* You are in a known build system (Current: $ENV:BHBuildSystem)`n" +
"`t* You are committing to the master branch (Current: $ENV:BHBranchName) `n" +
"`t* Module path is valid (Current: )" |
Write-Host
}
# Publish to AppVeyor if we're in AppVeyor
if ($env:BHBuildSystem -eq 'AppVeyor') {
Write-Host "Creating build with version '$($env:APPVEYOR_BUILD_VERSION)'"
Deploy DeveloperBuild {
By AppVeyorModule {
FromSource "$($env:BHBuildOutput)\Modules\$($env:BHProjectName)"
To AppVeyor
WithOptions @{
Version = $env:APPVEYOR_BUILD_VERSION
}
}
}
}