Skip to content

Commit

Permalink
(GH-217) Added deployment to separate MyGet Master Feed
Browse files Browse the repository at this point in the history
  • Loading branch information
gep13 committed Mar 1, 2015
1 parent ce06d62 commit 3c4d0ef
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
17 changes: 10 additions & 7 deletions BuildScripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@ if($Help){

if(Test-Path -Path env:\APPVEYOR) {
if($env:APPVEYOR_REPO_BRANCH -eq "develop" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null) {
Write-Host "Since we are on develop branch with no pull request number, we are ready to deploy to MyGet"
invoke-psake "$here/default.ps1" -task DeploySolutionToMyGet -properties @{ 'config'='Release'; }
Write-Host "Since we are on develop branch with no pull request number, we are ready to deploy to Develop MyGet Feed"
invoke-psake "$here/default.ps1" -task DeployDevelopSolutionToMyGet -properties @{ 'config'='Release'; }
} elseif($env:APPVEYOR_REPO_BRANCH -eq "develop" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {
Write-Host "Since we are on develop branch with a pull request number, we are just going to package the solution, with no deployment"
invoke-psake "$here/default.ps1" -task InspectCodeForProblems -properties @{ 'config'='Release'; }
} elseif($env:APPVEYOR_REPO_BRANCH -eq "master" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null) {
Write-Host "Since we are on master branch with no pull request number, we are ready to deploy to Chocolatey"
invoke-psake "$here/default.ps1" -task DeploySolutionToChocolatey -properties @{ 'config'='Release'; }
} elseif($env:APPVEYOR_REPO_BRANCH -eq "master" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) {
Write-Host "Since we are on master branch with a pull request number, we are just going to package the solution, with no deployment"
} elseif($env:APPVEYOR_REPO_BRANCH -eq "master" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null -And $env:APPVEYOR_REPO_TAG -eq $false) {
Write-Host "Since we are on master branch with no pull request number, and no tag applied, we are ready to deploy to Master MyGet Feed"
invoke-psake "$here/default.ps1" -task DeployMasterSolutionToMyGet -properties @{ 'config'='Release'; }
} elseif($env:APPVEYOR_REPO_BRANCH -eq "master" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null -And $env:APPVEYOR_REPO_TAG -eq $false) {
Write-Host "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"
invoke-psake "$here/default.ps1" -task InspectCodeForProblems -properties @{ 'config'='Release'; }
} elseif($env:APPVEYOR_REPO_BRANCH -eq "master" -And $env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null -And $env:APPVEYOR_REPO_TAG -eq $true) {
Write-Host "Since we are on master branch with no pull request number, and a tag has been applied, we are ready to deploy Chocolatey.org"
invoke-psake "$here/default.ps1" -task DeploySolutionToChocolatey -properties @{ 'config'='Release'; }
}
} else {
invoke-psake "$here/default.ps1" -task $Action -properties @{ 'config'=$Config; }
Expand Down
28 changes: 25 additions & 3 deletions BuildScripts/default.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ Task -Name __EchoAppVeyorEnvironmentVariables -Description $private -Action {
testEnvironmentVariable "APPVEYOR_REPO_SCM" $env:APPVEYOR_REPO_SCM;
testEnvironmentVariable "APPVEYOR_REPO_NAME" $env:APPVEYOR_REPO_NAME;
testEnvironmentVariable "APPVEYOR_REPO_BRANCH" $env:APPVEYOR_REPO_BRANCH;
testEnvironmentVariable "APPVEYOR_REPO_TAG" $env:APPVEYOR_REPO_TAG;
testEnvironmentVariable "APPVEYOR_REPO_TAG_NAME" $env:APPVEYOR_REPO_TAG_NAME;
testEnvironmentVariable "APPVEYOR_REPO_COMMIT" $env:APPVEYOR_REPO_COMMIT;
testEnvironmentVariable "APPVEYOR_REPO_COMMIT_AUTHOR" $env:APPVEYOR_REPO_COMMIT_AUTHOR;
testEnvironmentVariable "APPVEYOR_REPO_COMMIT_TIMESTAMP" $env:APPVEYOR_REPO_COMMIT_TIMESTAMP;
Expand Down Expand Up @@ -355,7 +357,9 @@ Task -Name PackageSolution -Depends RebuildSolution, PackageChocolatey -Descript

Task -Name InspectCodeForProblems -Depends PackageSolution, RunDupFinder, RunInspectCode -Description "Complete build, including running dupfinder, and inspectcode."

Task -Name DeploySolutionToMyGet -Depends InspectCodeForProblems, DeployPacakgeToMyGet -Description "Complete build, including creation of Chocolatey Package and Deployment to MyGet.org"
Task -Name DeployDevelopSolutionToMyGet -Depends InspectCodeForProblems, DeployDevelopPackageToMyGet -Description "Complete build, including creation of Chocolatey Package and Deployment to MyGet.org"

Task -Name DeployMasterSolutionToMyGet -Depends InspectCodeForProblems, DeployMasterPackageToMyGet -Description "Complete build, including creation of Chocolatey Package and Deployment to MyGet.org"

Task -Name DeploySolutionToChocolatey -Depends InspectCodeForProblems, DeployPackageToChocolatey -Description "Complete build, including creation of Chocolatey Package and Deployment to Chocolatey.org."

Expand Down Expand Up @@ -570,14 +574,32 @@ Task -Name PackageChocolatey -Description "Packs the module and example package"
}
}

Task -Name DeployPacakgeToMyGet -Description "Takes the packaged Chocolatey package and deploys to MyGet.org" -Action {
Task -Name DeployDevelopPackageToMyGet -Description "Takes the packaged Chocolatey package from develop branch and deploys to MyGet.org" -Action {
$buildArtifactsDirectory = get-buildArtifactsDirectory;

try {
Write-Output "Deploying to MyGet..."

exec {
& $nugetExe push "$buildArtifactsDirectory\*.nupkg" $env:MyGetDevelopApiKey -source $env:MyGetDevelopFeedUrl
}

Write-Host ("************ MyGet Deployment Successful ************")
}
catch {
Write-Error $_
Write-Host ("************ MyGet Deployment Failed ************")
}
}

Task -Name DeployMasterSolutionToMyGet -Description "Takes the packaged Chocolatey package from master branch and deploys to MyGet.org" -Action {
$buildArtifactsDirectory = get-buildArtifactsDirectory;

try {
Write-Output "Deploying to MyGet..."

exec {
& $nugetExe push "$buildArtifactsDirectory\*.nupkg" $env:MyGetApiKey -source $env:MyGetFeedUrl
& $nugetExe push "$buildArtifactsDirectory\*.nupkg" $env:MyGetMasterApiKey -source $env:MyGetMasterFeedUrl
}

Write-Host ("************ MyGet Deployment Successful ************")
Expand Down
7 changes: 5 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ clone_folder: C:\projects\ChocolateyGUI

# environment variables
environment:
MyGetApiKey:
MyGetDevelopApiKey:
secure: LeTveN6ryggcXR4fgZcaMOdvVHFxR6NNZZpaaxCG83D8waN4D1eEoLRv+5ZvLKLF
MyGetFeedUrl: https://www.myget.org/F/chocolateygui
MyGetDevelopFeedUrl: https://www.myget.org/F/chocolateygui
MyGetMasterApiKey:
secure: zTAGaSiQMYJeCl1dD+i/e0ZOZMT9Hq3nXd9fCzZE8/rHRnOkj4uUETfA2VbgjpCV
MyGetMasterFeedUrl: https://www.myget.org/F/chocolateygui_master/
ChocolateyApiKey:
secure: 2Sbie8uhFjl1v+NtLuR1oGcWnQE2M87jq0fSEwFOYcnNEC5qdwCkgVOG0MmC2Ffv
ChocolateyFeedUrl: http://chocolatey.org/api/v2/
Expand Down

0 comments on commit 3c4d0ef

Please sign in to comment.