1313 [string ]$branchName = " " ,
1414 [string ]$releaseName = " " ,
1515 [switch ]$test ,
16- [switch ]$prValidation ,
1716
1817 # Credentials
1918 [string ]$nugetApiKey = " "
@@ -27,6 +26,7 @@ function Get-PublishKey([string]$uploadUrl) {
2726 switch ($url.Host ) {
2827 " api.nuget.org" { return $nugetApiKey }
2928 # For publishing to azure, the API key can be any non-empty string as authentication is done in the pipeline.
29+ " devdiv.pkgs.visualstudio.com" { return " AzureArtifacts" }
3030 " pkgs.dev.azure.com" { return " AzureArtifacts" }
3131 default { throw " Cannot determine publish key for $uploadUrl " }
3232 }
@@ -38,28 +38,13 @@ function Publish-Nuget($publishData, [string]$packageDir) {
3838 # Retrieve the feed name to source mapping.
3939 $feedData = GetFeedPublishData
4040
41- # Let packageFeeds default to the default set of feeds
42- $packageFeeds = " default"
43- if ($publishData.PSobject.Properties.Name -contains " packageFeeds" ) {
44- $packageFeeds = $publishData.packageFeeds
45- }
46-
47- # If the configured packageFeeds is arcade, then skip publishing here. Arcade will handle publishing packages to their feeds.
48- if ($packageFeeds.equals (" arcade" ) -and -not $prValidation ) {
49- Write-Host " Skipping publishing for all packages as they will be published by arcade"
50- continue
51- }
41+ # The default feed we publish to for our official build is the VS feed.
42+ $feedName = " vs"
5243
53- # Let packageFeeds default to the default set of feeds
54- $packageFeeds = " default"
55- if ($publishData.PSobject.Properties.Name -contains " packageFeeds" ) {
56- $packageFeeds = $publishData.packageFeeds
44+ if ($publishData.PSobject.Properties.Name -contains " feed" ) {
45+ $feedName = $publishData.feed
5746 }
5847
59- # Each branch stores the name of the package to feed map it should use.
60- # Retrieve the correct map for this particular branch.
61- $packagesData = GetPackagesPublishData $packageFeeds
62-
6348 foreach ($package in Get-ChildItem * .nupkg) {
6449 Write-Host " "
6550
@@ -74,29 +59,6 @@ function Publish-Nuget($publishData, [string]$packageDir) {
7459 continue
7560 }
7661
77- $nupkgWithoutVersion = $nupkg -replace ' (\.\d+){3}-.*.nupkg' , ' '
78- if ($nupkgWithoutVersion.EndsWith (" .Symbols" )) {
79- Write-Host " Skipping symbol package $nupkg "
80- continue
81- }
82-
83- # Lookup the feed name from the packages map using the package name without the version or extension.
84- if (-not (Get-Member - InputObject $packagesData - Name $nupkgWithoutVersion )) {
85- throw " $nupkg has no configured feed (looked for $nupkgWithoutVersion )"
86- }
87-
88- $feedName = $packagesData .$nupkgWithoutVersion
89-
90- if ($prValidation ) {
91- $feedName = " vs"
92- }
93-
94- # If the configured feed is arcade, then skip publishing here. Arcade will handle publishing to their feeds.
95- if ($feedName.equals (" arcade" )) {
96- Write-Host " Skipping publishing for $nupkg as it is published by arcade"
97- continue
98- }
99-
10062 # Use the feed name to get the source to upload the package to.
10163 if (-not (Get-Member - InputObject $feedData - Name $feedName )) {
10264 throw " $feedName has no configured source feed"
@@ -116,23 +78,11 @@ function Publish-Nuget($publishData, [string]$packageDir) {
11678 }
11779}
11880
119- # Do basic verification on the values provided in the publish configuration
120- function Test-Entry ($publishData , [switch ]$isBranch ) {
121- if ($isBranch ) {
122- foreach ($nugetKind in $publishData.nugetKind ) {
123- if ($nugetKind -ne " PerBuildPreRelease" -and $nugetKind -ne " Shipping" -and $nugetKind -ne " NonShipping" ) {
124- throw " Branches are only allowed to publish Shipping, NonShipping, or PerBuildPreRelease"
125- }
126- }
127- }
128- }
129-
13081# Publish a given entry: branch or release.
13182function Publish-Entry ($publishData , [switch ]$isBranch ) {
132- Test-Entry $publishData - isBranch:$isBranch
133-
13483 # First publish the NuGet packages to the specified feeds
135- foreach ($nugetKind in $publishData.nugetKind ) {
84+ $nugetKinds = @ (' Shipping' , ' NonShipping' )
85+ foreach ($nugetKind in $nugetKinds ) {
13686 Publish-NuGet $publishData (Join-Path $PackagesDir $nugetKind )
13787 }
13888
0 commit comments