mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
co-authored by
Travis Plunk
parent
35994915e6
commit
b45be5c922
+1
-9
@@ -537,7 +537,7 @@ function Invoke-CIFinish
|
||||
switch -regex ($Runtime){
|
||||
default {
|
||||
$runPackageTest = $true
|
||||
$packageTypes = 'msi', 'nupkg', 'zip', 'zip-pdb', 'msix'
|
||||
$packageTypes = 'msi', 'zip', 'zip-pdb', 'msix'
|
||||
}
|
||||
'win-arm.*' {
|
||||
$runPackageTest = $false
|
||||
@@ -591,14 +591,6 @@ function Invoke-CIFinish
|
||||
throw "Packaging tests failed ($($packagingTestResult.FailedCount) failed/$($packagingTestResult.PassedCount) passed)"
|
||||
}
|
||||
}
|
||||
|
||||
# only publish assembly nuget packages if it is a daily build and tests passed
|
||||
if (Test-DailyBuild) {
|
||||
$nugetArtifacts = Get-ChildItem $PSScriptRoot\packaging\nugetOutput -ErrorAction SilentlyContinue -Filter *.nupkg | Select-Object -ExpandProperty FullName
|
||||
if ($nugetArtifacts) {
|
||||
$artifacts.AddRange(@($nugetArtifacts))
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Get-Error -InputObject $_
|
||||
|
||||
@@ -50,7 +50,7 @@ function Start-PSPackage {
|
||||
[string]$Name = "powershell",
|
||||
|
||||
# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
|
||||
[ValidateSet("msix", "deb", "osxpkg", "rpm", "rpm-fxdependent", "rpm-fxdependent-arm64", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size", "tar-alpine-fxdependent")]
|
||||
[ValidateSet("msix", "deb", "osxpkg", "rpm", "rpm-fxdependent", "rpm-fxdependent-arm64", "msi", "zip", "zip-pdb", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size", "tar-alpine-fxdependent")]
|
||||
[string[]]$Type,
|
||||
|
||||
# Generate windows downlevel package
|
||||
@@ -321,18 +321,18 @@ function Start-PSPackage {
|
||||
if (-not $Type) {
|
||||
$Type = if ($Environment.IsLinux) {
|
||||
if ($Environment.LinuxInfo.ID -match "ubuntu") {
|
||||
"deb", "nupkg", "tar"
|
||||
"deb", "tar"
|
||||
} elseif ($Environment.IsRedHatFamily) {
|
||||
"rpm", "nupkg"
|
||||
"rpm"
|
||||
} elseif ($Environment.IsSUSEFamily) {
|
||||
"rpm", "nupkg"
|
||||
"rpm"
|
||||
} else {
|
||||
throw "Building packages for $($Environment.LinuxInfo.PRETTY_NAME) is unsupported!"
|
||||
}
|
||||
} elseif ($Environment.IsMacOS) {
|
||||
"osxpkg", "nupkg", "tar"
|
||||
"osxpkg", "tar"
|
||||
} elseif ($Environment.IsWindows) {
|
||||
"msi", "nupkg", "msix"
|
||||
"msi", "msix"
|
||||
}
|
||||
Write-Warning "-Type was not specified, continuing with $Type!"
|
||||
}
|
||||
@@ -521,20 +521,6 @@ function Start-PSPackage {
|
||||
New-MSIXPackage @Arguments
|
||||
}
|
||||
}
|
||||
'nupkg' {
|
||||
$Arguments = @{
|
||||
PackageNameSuffix = $NameSuffix
|
||||
PackageSourcePath = $Source
|
||||
PackageVersion = $Version
|
||||
PackageRuntime = $Runtime
|
||||
PackageConfiguration = $Configuration
|
||||
Force = $Force
|
||||
}
|
||||
|
||||
if ($PSCmdlet.ShouldProcess("Create NuPkg Package")) {
|
||||
New-NugetContentPackage @Arguments
|
||||
}
|
||||
}
|
||||
"tar" {
|
||||
$Arguments = @{
|
||||
PackageSourcePath = $Source
|
||||
@@ -3051,95 +3037,6 @@ function Publish-NugetToMyGet
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
The function creates a nuget package for daily feed.
|
||||
|
||||
.DESCRIPTION
|
||||
The nuget package created is a content package and has all the binaries laid out in a flat structure.
|
||||
This package is used by install-powershell.ps1
|
||||
#>
|
||||
function New-NugetContentPackage
|
||||
{
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param (
|
||||
|
||||
# Name of the Product
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageName = 'powershell',
|
||||
|
||||
# Suffix of the Name
|
||||
[string] $PackageNameSuffix,
|
||||
|
||||
# Version of the Product
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageVersion,
|
||||
|
||||
# Runtime of the Product
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageRuntime,
|
||||
|
||||
# Configuration of the Product
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageConfiguration,
|
||||
|
||||
# Source Path to the Product Files - required to package the contents into an Zip
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $PackageSourcePath,
|
||||
|
||||
[Switch]
|
||||
$Force
|
||||
)
|
||||
|
||||
Write-Log "PackageVersion: $PackageVersion"
|
||||
$nugetSemanticVersion = Get-NugetSemanticVersion -Version $PackageVersion
|
||||
Write-Log "nugetSemanticVersion: $nugetSemanticVersion"
|
||||
|
||||
$nugetFolder = New-SubFolder -Path $PSScriptRoot -ChildPath 'nugetOutput' -Clean
|
||||
|
||||
$nuspecPackageName = $PackageName
|
||||
if ($PackageNameSuffix)
|
||||
{
|
||||
$nuspecPackageName += '-' + $PackageNameSuffix
|
||||
}
|
||||
|
||||
# Setup staging directory so we don't change the original source directory
|
||||
$stagingRoot = New-SubFolder -Path $PSScriptRoot -ChildPath 'nugetStaging' -Clean
|
||||
$contentFolder = Join-Path -Path $stagingRoot -ChildPath 'content'
|
||||
if ($PSCmdlet.ShouldProcess("Create staging folder")) {
|
||||
New-StagingFolder -StagingPath $contentFolder -PackageSourcePath $PackageSourcePath
|
||||
}
|
||||
|
||||
$projectFolder = Join-Path $PSScriptRoot 'projects/nuget'
|
||||
|
||||
$arguments = @('pack')
|
||||
$arguments += @('--output',$nugetFolder)
|
||||
$arguments += @('--configuration',$PackageConfiguration)
|
||||
$arguments += "/p:StagingPath=$stagingRoot"
|
||||
$arguments += "/p:RID=$PackageRuntime"
|
||||
$arguments += "/p:SemVer=$nugetSemanticVersion"
|
||||
$arguments += "/p:PackageName=$nuspecPackageName"
|
||||
$arguments += $projectFolder
|
||||
|
||||
Write-Log "Running dotnet $arguments"
|
||||
Write-Log "Use -verbose to see output..."
|
||||
Start-NativeExecution -sb {dotnet $arguments} | ForEach-Object {Write-Verbose $_}
|
||||
|
||||
$nupkgFile = "${nugetFolder}\${nuspecPackageName}-${packageRuntime}.${nugetSemanticVersion}.nupkg"
|
||||
if (Test-Path $nupkgFile)
|
||||
{
|
||||
Get-Item $nupkgFile
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Failed to create $nupkgFile"
|
||||
}
|
||||
}
|
||||
|
||||
function New-SubFolder
|
||||
{
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!--
|
||||
Due to https://github.com/dotnet/sdk/issues/1021
|
||||
When packaging we must build something.
|
||||
So, we are building an empty assembly called NotUsed, and discarding it.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<AssemblyName>NotUsed</AssemblyName>
|
||||
<Description>PowerShell nuget package with .NET CLI host including everything needed to run it.</Description>
|
||||
<NuspecFile>powershell.nuspec</NuspecFile>
|
||||
<NuspecProperties>runtime=$(RID);version=$(SemVer);PackageName=$(PackageName)</NuspecProperties>
|
||||
<NuspecBasePath>$(StagingPath)</NuspecBasePath>
|
||||
<IsTool>True</IsTool>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>$PackageName$-$runtime$</id>
|
||||
<version>$version$</version>
|
||||
<title>PowerShell for $runtime$</title>
|
||||
<authors>PowerShell</authors>
|
||||
<owners>PowerShell</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/powershell/powershell</projectUrl>
|
||||
<iconUrl>https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_64.png</iconUrl>
|
||||
<description>This package contains PowerShell for $runtime$.</description>
|
||||
<copyright>Copyright (c) Microsoft Corporation.</copyright>
|
||||
<tags>PowerShell</tags>
|
||||
|
||||
<contentFiles>
|
||||
<files include="**" buildAction="None" copyToOutput="true" flatten="false"/>
|
||||
</contentFiles>
|
||||
</metadata>
|
||||
</package>
|
||||
Reference in New Issue
Block a user