From 1220b16e39dd2bc1819ccf2a876077cbc476aac7 Mon Sep 17 00:00:00 2001 From: Joel Sallow <32407840+vexx32@users.noreply.github.com> Date: Thu, 6 May 2021 12:11:20 -0400 Subject: [PATCH] :rocket: (maint) Ensure build publishes Pester In some cases it looks like Pester can fail to publish if there are too many versions of Pester available. Prevent this by checking the version we actually need and publishing just that version when doing a publish to the filesystem. Also set the initially installed version of pester to the correct version based on the current required version specified by PSKoans itself, instead of having to update the environment-setup.yml each time. --- Deploy/Publish.ps1 | 6 +++--- templates/environment-setup.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Deploy/Publish.ps1 b/Deploy/Publish.ps1 index b567722a4..b17e3e5c6 100644 --- a/Deploy/Publish.ps1 +++ b/Deploy/Publish.ps1 @@ -16,12 +16,12 @@ if ($OutputDirectory) { Import-Module "$PSScriptRoot/PSKoans" $Module = Get-Module -Name PSKoans $Dependencies = @( - $Module.RequiredModules.Name - $Module.NestedModules.Name + $Module.RequiredModules | Select-Object -Property Name, Version + $Module.NestedModules | Select-Object -Property Name, Version ).Where{ $_ } foreach ($Module in $Dependencies) { - Publish-Module -Name $Module -Repository FileSystem -NugetApiKey "Test-Publish" + Publish-Module -Name $Module.Name -Repository FileSystem -NugetApiKey "Test-Publish" -RequiredVersion $Module.Version } } diff --git a/templates/environment-setup.yml b/templates/environment-setup.yml index 634a3f602..b24f3232c 100644 --- a/templates/environment-setup.yml +++ b/templates/environment-setup.yml @@ -17,7 +17,7 @@ steps: $Params.Name = 'Pester' $Params.SkipPublisherCheck = $true - $Params.MinimumVersion = '5.0.2' + $Params.MinimumVersion = (Get-Module -ListAvailable ./PSKoans).RequiredModules.Where{$_.Name -eq 'Pester'}.Version $Params | Out-String | Write-Host Install-Module @Params $Params.Remove('SkipPublisherCheck')