Skip to content
Merged
Show file tree
Hide file tree
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
33 changes: 18 additions & 15 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,7 @@ function Start-BuildPowerShellNativePackage

[Parameter(Mandatory = $true)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string] $psrpZipPath,

[Parameter(Mandatory = $true)]
[string] $NuGetOutputPath,

[switch] $SkipCleanup = $false
[string] $psrpZipPath
)

if(-not (Test-Path $PackageRoot))
Expand Down Expand Up @@ -605,24 +600,32 @@ function Start-BuildPowerShellNativePackage
Copy-Item $iconPath (Join-Path $PackageRoot -ChildPath $iconFileName) -Verbose

$Nuspec -f $Version, $iconFileName | Out-File -FilePath (Join-Path $PackageRoot -ChildPath 'Microsoft.PowerShell.Native.nuspec') -Force
}

if(-not (Test-Path $NuGetOutputPath))
{
$null = New-Item $NuGetOutputPath -Force -Verbose -ItemType Directory
}
<#
.SYNOPSIS
Pack the new nuget package from af folder.
#>
function New-NugetPackage {
param (
[Parameter(Mandatory)]
[string] $PackageRoot,

[Parameter(Mandatory)]
[string] $NuGetOutputPath
)

try {
if (-not (Test-Path $NuGetOutputPath)) {
$null = New-Item $NuGetOutputPath -Force -Verbose -ItemType Directory
}

Push-Location $PackageRoot
nuget.exe pack . -OutputDirectory $NuGetOutputPath
}
finally {
Pop-Location
}

if(-not $SkipCleanup -and (Test-Path $tempExtractionPath))
{
Remove-Item $tempExtractionPath -Recurse -Force -ErrorAction SilentlyContinue
}
}

<#
Expand Down
20 changes: 17 additions & 3 deletions tools/releaseBuild/yaml/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,23 @@ steps:
$macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip'
$psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip'

Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath)

displayName: 'Build NuGet package'
Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath

displayName: 'Collate NuGet package structure'

- ${{ if ne(variables['SkipSigning'], 'True') }}:
- template: Sbom.yml@ComplianceRepo
parameters:
BuildDropPath: '$(System.ArtifactsDirectory)\NugetPackage'
Build_Repository_Uri: https://github.com/PowerShell/PowerShell-Native
PackageName: Microsoft.PowerShell.Native
PackageVersion: $(PackageVersion)

- pwsh: |
Import-Module $(Build.SourcesDirectory)\build.psm1
$PackageRoot = "$(System.ArtifactsDirectory)\NugetPackage"
New-NugetPackage -PackageRoot $PackageRoot -NuGetOutputPath $(NuGetPackagePath)
displayName: Build NuGet package

- powershell: 'Get-Childitem $(NuGetPackagePath)'
displayName: 'Capture nuget package'
Expand Down