upgrade to powershellget 2.2.5

This commit is contained in:
Rui Lopes
2026-09-02 07:00:02 +00:00
parent f46a5bd8d4
commit ef3b8137d7
6 changed files with 67 additions and 17 deletions
Vendored
+2
View File
@@ -46,6 +46,8 @@ Vagrant.configure(2) do |config|
end
config.vm.provision :shell, inline: "echo '#{nexus_ip} #{nexus_domain}' | Out-File -Encoding Ascii -Append c:/Windows/System32/drivers/etc/hosts"
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-base.ps1', nexus_domain]
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-chocolatey.ps1']
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['provision-powershellget.ps1']
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-chocolatey-repository.ps1', nexus_domain]
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-powershell-repository.ps1', nexus_domain]
config.vm.provision :shell, path: 'provision/windows/ps.ps1', args: ['use-npm-repository.ps1', nexus_domain]
@@ -0,0 +1,6 @@
# install chocolatey.
# see https://community.chocolatey.org/packages/chocolatey
# renovate: datasource=nuget:chocolatey depName=chocolatey
$chocolateyVersion = '2.7.4'
$env:chocolateyVersion = $chocolateyVersion
Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
@@ -0,0 +1,35 @@
# install PowerShellGet v2.
# NB we cannot uninstall the built-in modules.
# see https://learn.microsoft.com/en-us/powershell/gallery/powershellget/install-powershellget?view=powershellget-2.x
$nugetPackageProviderVersion = '2.8.5.208'
Write-Host "Installing the NuGet $nugetPackageProviderVersion provider..."
Install-PackageProvider `
-Name NuGet `
-RequiredVersion $nugetPackageProviderVersion `
-Force `
| Format-List
# see https://community.chocolatey.org/packages/nuget.commandline
# renovate: datasource=nuget:chocolatey depName=nuget.commandline
$nugetVersion = '7.9.0'
Write-Host "Installing nuget $nugetVersion and configuring PowerShellGet to use it..."
choco install -y nuget.commandline --version $nugetVersion
$psGetNugetPath = 'C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe'
mkdir (Split-Path -Parent $psGetNugetPath) | Out-Null
New-Item `
-ItemType SymbolicLink `
-Path $psGetNugetPath `
-Target 'C:\ProgramData\chocolatey\lib\NuGet.CommandLine\tools\NuGet.exe' `
| Out-Null
# see https://www.powershellgallery.com/packages/PowerShellGet
# renovate: datasource=nuget:powershellgallery depName=PowerShellGet
$powerShellGetModuleVersion = '2.2.5'
Write-Host "Installing PowerShellGet $powerShellGetModuleVersion..."
Install-Module `
-Repository PSGallery `
-Name PowerShellGet `
-RequiredVersion $powerShellGetModuleVersion `
-AllowClobber `
-Force
@@ -2,9 +2,6 @@ param(
[string]$nexusDomain = 'nexus.example.com'
)
# install chocolatey.
Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Write-Host 'Default Chocolatey sources:'
choco sources list
@@ -10,7 +10,6 @@ Get-PSRepository
Write-Host 'Configuring PowerShell to only use the nexus server...'
Get-PSRepository | Unregister-PSRepository
Install-PackageProvider NuGet -Force
Register-PSRepository `
-Name nexus `
-SourceLocation https://$nexusDomain/repository/powershell-group/ `
@@ -20,19 +19,6 @@ Register-PSRepository `
Write-Host 'Current PowerShell sources:'
Get-PSRepository
Write-Host 'Installing the Sql Server module from the nexus server...'
Install-Module SqlServer
Write-Host 'Installing nuget and configuring PowerShellGet to use it...'
choco install -y nuget.commandline
$psGetNugetPath = 'C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe'
mkdir (Split-Path -Parent $psGetNugetPath) | Out-Null
New-Item `
-ItemType SymbolicLink `
-Path $psGetNugetPath `
-Target 'C:\ProgramData\chocolatey\lib\NuGet.CommandLine\tools\NuGet.exe' `
| Out-Null
Write-Host 'Publishing the ExampleGreeter module into the nexus server...'
Set-Location $env:TEMP
mkdir ExampleGreeter | Out-Null
+24
View File
@@ -17,5 +17,29 @@
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver-coerced{{/if}}",
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^v?(?<version>.+)${{/if}}"
},
// nuget:chocolatey datasource.
{
"fileMatch": [
"\\.ps1$"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>nuget):chocolatey depName=(?<depName>.+?)( versioning=(?<versioning>.+?))?( extractVersion=(?<extractVersion>.+?))?( registryUrl=(?<registryUrl>.+?))?\\s.+?[:=]\\s*[\"']?(?<currentValue>.+?)[\"']?\\s"
],
"registryUrlTemplate": "{{#if registryUrl}}{{{registryUrl}}}{{else}}https://community.chocolatey.org/api/v2{{/if}}",
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}nuget{{/if}}",
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^v?(?<version>.+)${{/if}}"
},
// nuget:powershellgallery datasource.
{
"fileMatch": [
"\\.ps1$"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>nuget):powershellgallery depName=(?<depName>.+?)( versioning=(?<versioning>.+?))?( extractVersion=(?<extractVersion>.+?))?( registryUrl=(?<registryUrl>.+?))?\\s.+?[:=]\\s*[\"']?(?<currentValue>.+?)[\"']?\\s"
],
"registryUrlTemplate": "{{#if registryUrl}}{{{registryUrl}}}{{else}}https://www.powershellgallery.com/api/v2{{/if}}",
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}nuget{{/if}}",
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^v?(?<version>.+)${{/if}}"
},
]
}