File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 7474 <Exec Command =" $(NuGet) pack ..\src\corelib\corelib.nuspec -OutputDirectory ..\artifacts\packages -Prop Configuration=$(Configuration) -Version $(Version) -Symbols" />
7575 </Target >
7676
77- <Target Name =" Publish" DependsOnTargets =" DownloadNuGet" >
77+ <Target Name =" PublishNuGet" DependsOnTargets =" DownloadNuGet" >
78+ <Exec Command =" @powershell -NoProfile -ExecutionPolicy unrestricted -File check-nuget-version-exists.ps1 $(Version)" ConsoleToMSBuild =" true" >
79+ <Output TaskParameter =" ConsoleOutput" PropertyName =" ShouldPublishToNuGet" />
80+ </Exec >
81+
7882 <!-- The environment variable BAMBOO_NUGET_PASSWORD comes from the nuget.password variable defined on the openstack.net plan in Bamboo -->
79- <Exec Command =" $(NuGet) push ..\artifacts\packages\openstack.net.$(Version).nupkg %25BAMBOO_NUGET_PASSWORD%25" />
83+ <Message Text =" Skipping publish to NuGet because version $(Version) has already been published."
84+ Condition =" '$(ShouldPublishToNuGet)' == 'False' " />
85+ <Exec Command =" $(NuGet) push ..\artifacts\packages\openstack.net.$(Version).nupkg %25BAMBOO_NUGET_PASSWORD%25"
86+ Condition =" '$(ShouldPublishToNuGet)' == 'True' " />
8087 </Target >
8188
8289</Project >
Original file line number Diff line number Diff line change 1+ param (
2+ [string ]$version
3+ )
4+
5+ try {
6+ $url = " http://nuget.org/packages/openstack.net/$version "
7+ $status = (Invoke-WebRequest $url ).StatusCode
8+ } catch {
9+ $status = $_.Exception.Response.StatusCode.Value__
10+ }
11+
12+ $shouldPublishToNuGet = $status -eq ' 404'
13+ Write-Host $shouldPublishToNuGet
You can’t perform that action at this time.
0 commit comments