1
+ # The creation of this build script (and associated files) was only possible using the
2
+ # work that was done on the BoxStarter Project on GitHub:
3
+ # http://boxstarter.codeplex.com/
4
+ # Big thanks to Matt Wrock (@mwrockx} for creating this project, thanks!
5
+
6
+ param (
7
+ [string ]$Action = " default" ,
8
+ [string ]$Config = " Debug" ,
9
+ [switch ]$Help
10
+ )
11
+
12
+ $here = " $ ( Split-Path - parent $MyInvocation.MyCommand.Definition ) "
13
+ $psakePath = Join-Path $here - Child " ..\Tools\psake\psake.psm1" ;
14
+ Import-Module $psakePath ;
15
+
16
+ if ($Help ){
17
+ try {
18
+ Get-Help " $ ( $MyInvocation.MyCommand.Definition ) " - full | Out-Host - paging
19
+ Write-Output " Available build tasks:"
20
+ invoke-psake " $here /default.ps1" - nologo - docs | Out-Host - paging
21
+ } catch {}
22
+
23
+ return
24
+ }
25
+
26
+ if (Test-Path - Path env:\APPVEYOR) {
27
+ if ($env: APPVEYOR_REPO_BRANCH -eq " develop" -And $env: APPVEYOR_PULL_REQUEST_NUMBER -eq $null ) {
28
+ Write-Output " Since we are on develop branch with no pull request number, we are ready to deploy to Develop MyGet Feed"
29
+ invoke-psake " $here /default.ps1" - task DeployDevelopSolutionToMyGet - properties @ { ' config' = ' Release' ; }
30
+ } elseif ($env: APPVEYOR_REPO_BRANCH -eq " develop" -And $env: APPVEYOR_PULL_REQUEST_NUMBER -ne $null ) {
31
+ Write-Output " Since we are on develop branch with a pull request number, we are just going to package the solution, with no deployment"
32
+ invoke-psake " $here /default.ps1" - task InspectCodeForProblems - properties @ { ' config' = ' Release' ; }
33
+ } elseif ($env: APPVEYOR_REPO_BRANCH -eq " master" -And $env: APPVEYOR_PULL_REQUEST_NUMBER -eq $null -And $env: APPVEYOR_REPO_TAG -eq $false ) {
34
+ Write-Output " Since we are on master branch with no pull request number, and no tag applied, we are ready to deploy to Master MyGet Feed"
35
+ invoke-psake " $here /default.ps1" - task DeployMasterSolutionToMyGet - properties @ { ' config' = ' Release' ; }
36
+ } elseif ($env: APPVEYOR_REPO_BRANCH -eq " master" -And $env: APPVEYOR_PULL_REQUEST_NUMBER -ne $null -And $env: APPVEYOR_REPO_TAG -eq $false ) {
37
+ Write-Output " Since we are on master branch with a pull request number, and no tag applied, we are just going to package the solution, with no deployment"
38
+ invoke-psake " $here /default.ps1" - task InspectCodeForProblems - properties @ { ' config' = ' Release' ; }
39
+ } elseif ($env: APPVEYOR_REPO_BRANCH -eq " master" -And $env: APPVEYOR_PULL_REQUEST_NUMBER -eq $null -And $env: APPVEYOR_REPO_TAG -eq $true ) {
40
+ Write-Output " Since we are on master branch with no pull request number, and a tag has been applied, we are ready to deploy Chocolatey.org"
41
+ invoke-psake " $here /default.ps1" - task DeploySolutionToChocolatey - properties @ { ' config' = ' Release' ; }
42
+ }
43
+ } else {
44
+ invoke-psake " $here /default.ps1" - task $Action - properties @ { ' config' = $Config ; }
45
+ }
46
+
47
+ # If for some reason, the above if statement doesn't actually invoke-psake, the $psake.build_success will be false
48
+ # so it will exit with a code of 1 below, which will fail the build.
49
+ if ($psake.build_success -eq $false ) {
50
+ exit 1
51
+ } else {
52
+ exit 0
53
+ }
0 commit comments