forked from powareverb/coreos-hyperv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.psdeploy.ps1
64 lines (58 loc) · 1.65 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Generic module deployment.
# This stuff should be moved to psake for a cleaner deployment view
# ASSUMPTIONS:
# folder structure of:
# - RepoFolder
# - This PSDeploy file
# - ModuleName
# - ModuleName.psd1
# Nuget key in $ENV:NugetApiKey
#Deploy to local repo
if(
$env:BHProjectName -and $env:BHProjectName.Count -eq 1 -and
$env:BHBuildSystem -eq 'Unknown' -and
$env:BHBranchName -eq "master"
)
{
Deploy Module {
By FileSystem {
FromSource $ENV:BHProjectName
To '$($ENV:BHProjectName)/../0Repo'
}
}
}
# Set-BuildEnvironment from BuildHelpers module has populated ENV:BHProjectName
# Publish to gallery with a few restrictions
if(
$env:BHProjectName -and
$env:BHBuildSystem -ne 'Unknown' -and
$env:BHBranchName -match "master" -and
$env:BHCommitMessage -match '!deploy'
)
{
Deploy Module {
By PSGalleryModule {
FromSource $ENV:BHProjectName
To PSGallery
WithOptions @{
ApiKey = $ENV:NugetApiKey
}
}
# By PSGalleryModule {
# FromSource $ENV:BHProjectName
# To PSGallery
# WithOptions @{
# ApiKey = $ENV:NugetApiKey
# }
# }
}
}
else
{
"Skipping gallery deployment: To deploy, ensure that...`n" +
"`t* Project name is set (Current: $ENV:BHProjectName)`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* Your commit message includes !deploy (Current: $ENV:BHCommitMessage)" |
Write-Host
}