mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-23 09:43:57 +08:00
Use one feed in each nuget.config in official builds (#14363)
Co-authored-by: Robert Holt <rjmholt@gmail.com>
This commit is contained in:
parent
fb9ed74a53
commit
7c03ad61c1
18
build.psm1
18
build.psm1
@ -337,7 +337,8 @@ function Start-PSBuild {
|
||||
try {
|
||||
# Excluded sqlite3 folder is due to this Roslyn issue: https://github.com/dotnet/roslyn/issues/23060
|
||||
# Excluded src/Modules/nuget.config as this is required for release build.
|
||||
git clean -fdX --exclude .vs/PowerShell/v16/Server/sqlite3 --exclude src/Modules/nuget.config
|
||||
# Excluded nuget.config as this is required for release build.
|
||||
git clean -fdX --exclude .vs/PowerShell/v16/Server/sqlite3 --exclude src/Modules/nuget.config --exclude nuget.config
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
@ -628,7 +629,9 @@ function Restore-PSPackage
|
||||
|
||||
[switch] $Force,
|
||||
|
||||
[switch] $InteractiveAuth
|
||||
[switch] $InteractiveAuth,
|
||||
|
||||
[switch] $PSModule
|
||||
)
|
||||
|
||||
if (-not $ProjectDirs)
|
||||
@ -652,7 +655,10 @@ function Restore-PSPackage
|
||||
'Microsoft.NET.Sdk'
|
||||
}
|
||||
|
||||
if ($Options.Runtime -notlike 'fxdependent*') {
|
||||
if ($PSModule.IsPresent) {
|
||||
$RestoreArguments = @("--verbosity")
|
||||
}
|
||||
elseif ($Options.Runtime -notlike 'fxdependent*') {
|
||||
$RestoreArguments = @("--runtime", $Options.Runtime, "/property:SDKToUse=$sdkToUse", "--verbosity")
|
||||
} else {
|
||||
$RestoreArguments = @("/property:SDKToUse=$sdkToUse", "--verbosity")
|
||||
@ -2500,7 +2506,7 @@ function Copy-PSGalleryModules
|
||||
|
||||
Find-DotNet
|
||||
|
||||
Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent
|
||||
Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent -PSModule
|
||||
|
||||
$cache = dotnet nuget locals global-packages -l
|
||||
if ($cache -match "global-packages: (.*)") {
|
||||
@ -3282,8 +3288,10 @@ function New-NugetConfigFile
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="[FEEDNAME]" value="[FEED]" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
<packageSourceCredentials>
|
||||
<[FEEDNAME]>
|
||||
<add key="Username" value="[USERNAME]" />
|
||||
|
@ -4,8 +4,8 @@
|
||||
<clear />
|
||||
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="powershell_nuget" value="https://powershell.pkgs.visualstudio.com/PowerShell/_packaging/powershell/nuget/v3/index.json" />
|
||||
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
</configuration>
|
||||
|
@ -1,6 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||
|
||||
<Import Project="..\..\PowerShell.Common.props" />
|
||||
<PropertyGroup>
|
||||
<Product>PowerShell</Product>
|
||||
<Company>Microsoft Corporation</Company>
|
||||
<Copyright>(c) Microsoft Corporation.</Copyright>
|
||||
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
||||
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PowerShellGet" Version="2.2.5" />
|
||||
|
11
src/Modules/nuget.config
Normal file
11
src/Modules/nuget.config
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
|
||||
<add key="powershell_nuget" value="https://powershell.pkgs.visualstudio.com/PowerShell/_packaging/powershell/nuget/v3/index.json" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
</configuration>
|
10
test/tools/Modules/nuget.config
Normal file
10
test/tools/Modules/nuget.config
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
</configuration>
|
@ -18,7 +18,7 @@ steps:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module -Force "$(Build.SourcesDirectory)/tools/releaseBuild/azureDevOps/AzArtifactFeed/SyncGalleryToAzArtifacts.psm1"
|
||||
SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT) -Destination $(Build.ArtifactStagingDirectory)
|
||||
SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT2) -Destination $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download packages from PSGallery that need to be updated
|
||||
condition: succeededOrFailed()
|
||||
|
||||
|
@ -1,11 +1,25 @@
|
||||
steps:
|
||||
- powershell: |
|
||||
Import-Module $env:REPOROOT/build.psm1 -Force
|
||||
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination $env:REPOROOT/src/Modules
|
||||
parameters:
|
||||
- name: "repoRoot"
|
||||
default: $(REPOROOT)
|
||||
|
||||
if(-not (Test-Path "$env:REPOROOT/src/Modules/nuget.config"))
|
||||
steps:
|
||||
- pwsh: |
|
||||
Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
|
||||
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination '${{ parameters.repoRoot }}/src/Modules'
|
||||
|
||||
if(-not (Test-Path "${{ parameters.repoRoot }}/src/Modules/nuget.config"))
|
||||
{
|
||||
throw "nuget.config is not created"
|
||||
}
|
||||
displayName: 'Add nuget.config for Azure DevOps feed for PSGallery modules'
|
||||
condition: and(succeededOrFailed(), ne(variables['AzDevOpsFeed'], ''))
|
||||
- pwsh: |
|
||||
Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
|
||||
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsPackageFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination '${{ parameters.repoRoot }}'
|
||||
|
||||
if(-not (Test-Path "${{ parameters.repoRoot }}/nuget.config"))
|
||||
{
|
||||
throw "nuget.config is not created"
|
||||
}
|
||||
displayName: 'Add nuget.config for Azure DevOps feed for packages'
|
||||
condition: and(succeededOrFailed(), ne(variables['AzDevOpsPackageFeed'], ''))
|
||||
|
@ -42,7 +42,8 @@ jobs:
|
||||
displayName: 'Skip Alpine or fxdependent for PS v6.0.*'
|
||||
|
||||
- template: insert-nuget-config-azfeed.yml
|
||||
|
||||
parameters:
|
||||
repoRoot: $(REPOROOT)
|
||||
|
||||
- powershell: |
|
||||
import-module "$env:REPOROOT/build.psm1"
|
||||
@ -51,7 +52,9 @@ jobs:
|
||||
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
|
||||
|
||||
- powershell: |
|
||||
$env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
|
||||
& "$env:REPOROOT/tools/releaseBuild/vstsbuild.ps1" -ReleaseTag $(ReleaseTagVar) -Name '$(build)'
|
||||
$env:AzDevOpsFeedPAT2 = $null
|
||||
|
||||
displayName: 'Build and package'
|
||||
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
|
||||
|
@ -35,20 +35,14 @@ jobs:
|
||||
tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -location $(PowerShellRoot) -BootStrap
|
||||
displayName: 'Bootstrap VM'
|
||||
|
||||
- pwsh: |
|
||||
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
|
||||
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination "$(PowerShellRoot)/src/Modules"
|
||||
|
||||
if(-not (Test-Path "$(PowerShellRoot)/src/Modules/nuget.config"))
|
||||
{
|
||||
throw "nuget.config is not created"
|
||||
}
|
||||
displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules '
|
||||
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
|
||||
parameters:
|
||||
repoRoot: $(PowerShellRoot)
|
||||
|
||||
- pwsh: |
|
||||
$env:AZDEVOPSFEEDPAT = '$(AzDevOpsFeedPAT)'
|
||||
$env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
|
||||
$(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -Symbols -location $(PowerShellRoot) -Build -ArtifactName macosBinResults
|
||||
$env:AZDEVOPSFEEDPAT = $null
|
||||
$env:AzDevOpsFeedPAT2 = $null
|
||||
displayName: 'Build'
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
|
@ -31,10 +31,12 @@ jobs:
|
||||
parameters:
|
||||
ReleaseTagVar: $(ReleaseTagVar)
|
||||
|
||||
- template: insert-nuget-config-azfeed.yml
|
||||
|
||||
- template: cloneToOfficialPath.yml
|
||||
|
||||
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
|
||||
parameters:
|
||||
repoRoot: $(PowerShellRoot)
|
||||
|
||||
- powershell: |
|
||||
|
||||
$runtime = switch ($env:Architecture)
|
||||
|
@ -60,7 +60,7 @@ jobs:
|
||||
|
||||
- template: cloneToOfficialPath.yml
|
||||
|
||||
- powershell: |
|
||||
- pwsh: |
|
||||
# cleanup previous install
|
||||
if((Test-Path "${env:ProgramFiles(x86)}\WiX Toolset xcopy")) {
|
||||
Remove-Item "${env:ProgramFiles(x86)}\WiX Toolset xcopy" -Recurse -Force
|
||||
@ -68,7 +68,7 @@ jobs:
|
||||
|
||||
$toolsDir = New-Item -ItemType Directory -Path '$(Build.ArtifactStagingDirectory)\tools'
|
||||
$wixUri = 'https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip'
|
||||
Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip'
|
||||
Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip' -MaximumRetryCount 5 -RetryIntervalSec 10
|
||||
|
||||
Import-Module '$(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/wix.psm1'
|
||||
Install-WixZip -zipPath '$(Build.ArtifactStagingDirectory)\tools\wix.zip'
|
||||
|
Loading…
Reference in New Issue
Block a user