diff --git a/tools/releaseBuild/azureDevOps/templates/nuget.yml b/tools/releaseBuild/azureDevOps/templates/nuget.yml index db0198132cb..4e303e17439 100644 --- a/tools/releaseBuild/azureDevOps/templates/nuget.yml +++ b/tools/releaseBuild/azureDevOps/templates/nuget.yml @@ -54,13 +54,21 @@ jobs: version: '$(SDKVersion)' - task: DownloadBuildArtifacts@0 - displayName: 'Download PowerShell build artifacts' + displayName: 'Download PowerShell build artifacts - finalResults' inputs: buildType: current downloadType: single artifactName: finalResults downloadPath: '$(System.ArtifactsDirectory)' + - task: DownloadBuildArtifacts@0 + displayName: 'Download PowerShell build artifacts - macosPkgResults' + inputs: + buildType: current + downloadType: single + artifactName: macosPkgResults + downloadPath: '$(System.ArtifactsDirectory)' + - powershell: 'Get-ChildItem $(System.ArtifactsDirectory) -recurse' displayName: 'Capture downloaded artifacts' @@ -182,6 +190,40 @@ jobs: Get-ChildItem "$(System.ArtifactsDirectory)\signed\globaltool" -Recurse displayName: Move global tool packages to subfolder and capture + - pwsh: | + $packagePath = (Join-Path $(System.ArtifactsDirectory) checksum) + New-Item $packagePath -ItemType Directory -Force > $null + $srcPaths = @("$(System.ArtifactsDirectory)\finalResults", "$(System.ArtifactsDirectory)\macosPkgResults", "$(System.ArtifactsDirectory)\signed") + + $packages = Get-ChildItem -Path $srcPaths -Include *.zip, *.tar.gz, *.msi*, *.pkg, *.deb, *.rpm -Exclude "PowerShell-Symbols*" -Recurse + $packages | ForEach-Object { Copy-Item $_.FullName -Destination $packagePath -Verbose } + + $packagePathList = Get-ChildItem $packagePath -Recurse | Select-Object -ExpandProperty FullName | Out-String + Write-Verbose -Verbose $packagePathList + + Get-ChildItem -Path $packagePath | + ForEach-Object { + Write-Verbose -Verbose "Generating checksum file for $($_.FullName)" + $packageName = $_.Name + $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA512).Hash.ToLower() + + # the '*' before the packagename signifies it is a binary + "$hash *$packageName" + } | + Out-File -FilePath "$packagePath\SHA512SUMS" -Force + + $fileContent = Get-Content -Path "$packagePath\SHA512SUMS" -Raw | Out-String + Write-Verbose -Verbose -Message $fileContent + + Copy-Item -Path "$packagePath\SHA512SUMS" -Destination '$(System.ArtifactsDirectory)\signed\' -verbose + Copy-Item -Path "$packagePath\SHA512SUMS" -Destination '$(System.ArtifactsDirectory)\signed\globaltool\' -verbose + displayName: Generate checksum file + + - template: upload-final-results.yml + parameters: + artifactPath: '$(System.ArtifactsDirectory)\checksum' + artifactFilter: SHA512SUMS + - task: AzureFileCopy@4 displayName: 'Upload NuGet packages to Azure' inputs: