Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion tools/releaseBuild/azureDevOps/templates/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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:
Expand Down