Package only from the powershell folder at the root directory (#4569)

This commit is contained in:
Travis Plunk 2017-08-15 16:17:45 -07:00 committed by Dongbo Wang
parent 498680a252
commit 0ca44f147d
4 changed files with 31 additions and 5 deletions

View file

@ -723,7 +723,23 @@ function New-PSOptions {
$Top = [IO.Path]::Combine($PSScriptRoot, "src", "System.Management.Automation")
}
return @{ Top = $Top;
$RootInfo = @{RepoPath = $PSScriptRoot}
# the valid root is the root of the filesystem and the folder PowerShell
$RootInfo['ValidPath'] = Join-Path -Path ([system.io.path]::GetPathRoot($RootInfo.RepoPath)) -ChildPath 'PowerShell'
if($RepoInfo.RepoPath -ne $RootInfo.ValidPath)
{
$RootInfo['Warning'] = "Please ensure you repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!"
$RootInfo['IsValid'] = $false
}
else
{
$RootInfo['IsValid'] = $true
}
return @{ RootInfo = [PSCustomObject]$RootInfo
Top = $Top;
Configuration = $Configuration;
Framework = $Framework;
Runtime = $Runtime;

View file

@ -448,7 +448,7 @@ function Invoke-AppveyorFinish
}
# Build packages
$packages = Start-PSPackage @packageParams
$packages = Start-PSPackage @packageParams -SkipReleaseChecks
$name = Get-PackageName

View file

@ -29,7 +29,9 @@ function Start-PSPackage {
[Switch] $Force,
[Switch] $IncludeSymbols
[Switch] $IncludeSymbols,
[Switch] $SkipReleaseChecks
)
# Runtime and Configuration settings required by the package
@ -81,6 +83,13 @@ function Start-PSPackage {
throw "Please ensure you have run 'Start-PSBuild $params'!"
}
if($SkipReleaseChecks.IsPresent) {
Write-Warning "Skipping release checks."
}
elseif(!$Script:Options.RootInfo.IsValid){
throw $Script:Options.RootInfo.Warning
}
# If ReleaseTag is specified, use the given tag to calculate Vesrion
if ($PSCmdlet.ParameterSetName -eq "ReleaseTag") {
$Version = $ReleaseTag -Replace '^v'

View file

@ -179,8 +179,9 @@ else
$packageParams += @{Version=$version}
}
# Only build packages for branches, not pull requests
$packages = @(Start-PSPackage @packageParams)
$packages += Start-PSPackage @packageParams -Type AppImage
$packages = @(Start-PSPackage @packageParams -SkipReleaseChecks)
# Packaging AppImage depends on the deb package
$packages += Start-PSPackage @packageParams -Type AppImage -SkipReleaseChecks
foreach($package in $packages)
{
# Publish the packages to the nuget feed if: