Skip to content

Commit 15c2404

Browse files
More attempts to get myget working.
1 parent 7a7063d commit 15c2404

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

appveyor.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ matrix:
2525
environment:
2626
COVERALLS_REPO_TOKEN:
2727
secure: 1hvfHFO3qtGTcwB+AnCGYsn0az0j9MzAux5hee5CFeyRJ+lWut0LjnyqvsI/5Pfa
28-
MYGET_SOURCE: https://www.myget.org/F/imageprocessor/api/v2/package
2928
MYGET_API_KEY:
3029
secure: fz0rUrt3B1HczUC1ZehwVsrFSWX9WZGDQoueDztLte9/+yQG+BBU7UrO+coE8lUf
30+
MYGET_SOURCE: https://www.myget.org/F/imageprocessor/api/v2/package
3131

3232
#---------------------------------#
3333
# build configuration #
@@ -61,7 +61,7 @@ artifacts:
6161
# on successful build
6262
on_success:
6363
- ps: Import-Module .\build\psake.psm1
64-
- ps: Invoke-Psake .\build\build.ps1 Publish-Myget -properties @{"MygetApiKey"=$env:MYGET_API_KEY;"MygetSource"=$env:MYGET_SOURCE}
65-
- ps: Invoke-Psake .\build\build.ps1 Publish-Nuget -properties @{"NugetApiKey"=$env:APIKEY;"NugetSource"=$env:SOURCE}
64+
- ps: Invoke-Psake .\build\build.ps1 Publish-Myget -properties @{"MygetApiKey"=$env:MYGET_API_KEY;"MygetSource"=$env:MYGET_SOURCE;"AppVeyorPullRequestNumber"=$env:APPVEYOR_PULL_REQUEST_NUMBER}
65+
- ps: Invoke-Psake .\build\build.ps1 Publish-Nuget -properties @{"NugetApiKey"=$env:APIKEY;"NugetSource"=$env:SOURCE;"AppVeyorPullRequestNumber"=$env:APPVEYOR_PULL_REQUEST_NUMBER}
6666
on:
6767
branch: master

build/build.ps1

+14-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ properties {
44
$MygetSource = $null
55
$NugetApiKey = $null
66
$NugetSource = $null
7+
$AppVeyorPullRequestNumber = $null
78

89
# see appveyor.yml for usage
910
$BuildNumber = $null
@@ -218,8 +219,15 @@ task Generate-Nuget -depends Set-VersionNumber, Build-Solution {
218219

219220
# publishes the Myget on a feed
220221
task Publish-Myget {
222+
223+
Write-Host "MygetApiKey $MygetApiKey"
224+
225+
if($AppVeyorPullRequestNumber -neq $null){
226+
return
227+
}
228+
221229
if ($MygetApiKey -eq $null -or $MygetApiKey -eq "") {
222-
throw New-Object [System.ArgumentException] "You must provide an API key as parameter: 'Invoke-psake Publish-Myget -properties @{`"MygetApiKey`"=`"YOURAPIKEY`"}' ; or add a APIKEY environment variable to AppVeyor"
230+
throw New-Object [System.ArgumentException] "You must provide a Myget API key as parameter: 'Invoke-psake Publish-Myget -properties @{`"MygetApiKey`"=`"YOURAPIKEY`"}' ; or add a APIKEY environment variable to AppVeyor"
223231
}
224232

225233
Get-ChildItem $NUGET_OUTPUT -Filter "*.nugpkg" | % {
@@ -229,8 +237,12 @@ task Publish-Myget {
229237

230238
# publishes the Nuget on a feed
231239
task Publish-Nuget {
240+
if($AppVeyorPullRequestNumber -neq $null){
241+
return
242+
}
243+
232244
if ($NugetApiKey -eq $null -or $NugetApiKey -eq "") {
233-
throw New-Object [System.ArgumentException] "You must provide an API key as parameter: 'Invoke-psake Publish-Nuget -properties @{`"NugetApiKey`"=`"YOURAPIKEY`"}' ; or add a APIKEY environment variable to AppVeyor"
245+
throw New-Object [System.ArgumentException] "You must provide a Nuget API key as parameter: 'Invoke-psake Publish-Nuget -properties @{`"NugetApiKey`"=`"YOURAPIKEY`"}' ; or add a APIKEY environment variable to AppVeyor"
234246
}
235247

236248
Get-ChildItem $NUGET_OUTPUT -Filter "*.nugpkg" | % {

0 commit comments

Comments
 (0)