-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDeploy.PSDeploy.ps1
43 lines (41 loc) · 1.47 KB
/
Deploy.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
if(
$env:ProjectName -and $ENV:ProjectName.Count -eq 1 -and
$env:BuildSystem -eq 'AppVeyor'
)
{
Write-Host "PR: $Env:APPVEYOR_PULL_REQUEST_NUMBER"
if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER -and
$Env:BuildSystem -eq 'AppVeyor' -and
$Env:BranchName -eq 'master' -and
$Env:NuGetApiKey -and
$Env:CommitMessage -match '!Deploy'
) {
$manifest = Import-PowerShellDataFile -Path ".\$Env:ProjectName\$Env:ProjectName.psd1"
$manifest.RequiredModules|ForEach-Object {
$ReqModuleName = ([Microsoft.PowerShell.Commands.ModuleSpecification]$_).Name
$InstallModuleParams = @{Name = $ReqModuleName}
if($ReqModuleVersion = ([Microsoft.PowerShell.Commands.ModuleSpecification]$_).RequiredVersion) {
$InstallModuleParams.Add('RequiredVersion',$ReqModuleVersion)
}
Install-Module @InstallModuleParams -Force
}
Deploy Module {
By PSGalleryModule {
FromSource $(Get-Item ".\BuildOutput\$Env:ProjectName")
To PSGallery
WithOptions @{
ApiKey = $Env:NuGetApiKey
}
}
}
}
Deploy DeveloperBuild {
By AppVeyorModule {
FromSource $(Get-Item ".\BuildOutput\$Env:ProjectName\$Env:ProjectName.psd1")
To AppVeyor
WithOptions @{
Version = $env:APPVEYOR_BUILD_VERSION
}
}
}
}