@@ -110,7 +110,7 @@ function Publish-dotnet-GithubIODocs ($DocLocation, $PublicArtifactLocation)
110110 New-Item - ItemType directory - Path $TempDir
111111
112112 Expand-Archive - LiteralPath $PublishedDocs [0 ].FullName - DestinationPath $DocsStagingDir
113- $pkgProperties = ParseNugetPackage - pkg $PublishedPkgs [0 ].FullName - workingDirectory $TempDir
113+ $pkgProperties = Get-dotnet - PackageInfoFromPackageFile - pkg $PublishedPkgs [0 ].FullName - workingDirectory $TempDir
114114
115115 Write-Host " Start Upload for $ ( $pkgProperties.ReleaseTag ) "
116116 Write-Host " DocDir $ ( $DocsStagingDir ) "
@@ -128,4 +128,47 @@ function Get-dotnet-GithubIoDocIndex() {
128128 $tocContent = Get-TocMapping - metadata $metadata - artifacts $artifacts
129129 # Generate yml/md toc files and build site.
130130 GenerateDocfxTocContent - tocContent $tocContent - lang " NET"
131+ }
132+
133+ # details on CSV schema can be found here
134+ # https://review.docs.microsoft.com/en-us/help/onboard/admin/reference/dotnet/documenting-nuget?branch=master#set-up-the-ci-job
135+ function Update-dotnet-CIConfig ($pkgs , $ciRepo , $locationInDocRepo , $monikerId = $null ){
136+ $csvLoc = (Join-Path - Path $ciRepo - ChildPath $locationInDocRepo )
137+
138+ if (-not (Test-Path $csvLoc )) {
139+ Write-Error " Unable to locate package csv at location $csvLoc , exiting."
140+ exit (1 )
141+ }
142+
143+ $allCSVRows = Get-Content $csvLoc
144+ $visibleInCI = @ {}
145+
146+ # first pull what's already available
147+ for ($i = 0 ; $i -lt $allCSVRows.Length ; $i ++ ) {
148+ $pkgDef = $allCSVRows [$i ]
149+
150+ # get rid of the modifiers to get just the package id
151+ $id = $pkgDef.split (" ," )[1 ] -replace " \[.*?\]" , " "
152+
153+ $visibleInCI [$id ] = $i
154+ }
155+
156+ foreach ($releasingPkg in $pkgs ) {
157+ $installModifiers = " tfm=netstandard2.0"
158+ if ($releasingPkg.IsPrerelease ) {
159+ $installModifiers += " ;isPrerelease=true"
160+ }
161+ $lineId = $releasingPkg.PackageId.Replace (" ." , " " ).ToLower()
162+
163+ if ($visibleInCI.ContainsKey ($releasingPkg.PackageId )) {
164+ $packagesIndex = $visibleInCI [$releasingPkg.PackageId ]
165+ $allCSVRows [$packagesIndex ] = " $ ( $lineId ) ,[$installModifiers ]$ ( $releasingPkg.PackageId ) "
166+ }
167+ else {
168+ $newItem = " $ ( $lineId ) ,[$installModifiers ]$ ( $releasingPkg.PackageId ) "
169+ $allCSVRows += ($newItem )
170+ }
171+ }
172+
173+ Set-Content - Path $csvLoc - Value $allCSVRows
131174}
0 commit comments