Skip to content

Commit

Permalink
Install modules under default context
Browse files Browse the repository at this point in the history
  • Loading branch information
natescherer committed Aug 1, 2023
1 parent f431e41 commit ad7a12e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/steps/2_prepare.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Write-Host -Object "Ensuring PowerShellGet 2.2.5 is installed..."
$PowerShellGetMetadata = Get-Module -Name PowerShellGet
if ($PowerShellGetMetadata.Version -ge "2.2.5") {
Write-Host -Object "Updating PowerShellGet to 2.2.5..."
Install-Module -Name PowerShellGet -Force -AllowClobber -Scope AllUsers
Install-Module -Name PowerShellGet -Force -AllowClobber
}
else {
Write-Host -Object "PowerShellGet is up-to-date."
Expand All @@ -18,20 +18,20 @@ else {
$PSResourceGetMetadata = Get-Module -ListAvailable -Name Microsoft.PowerShell.PSResourceGet
if (!$PSResourceGetMetadata) {
Write-Host -Object "'Microsoft.PowerShell.PSResourceGet' is not installed, now installing..."
Install-Module -Name Microsoft.PowerShell.PSResourceGet -RequiredVersion $PsrgPinnedVer -Force -AllowPrerelease -Scope AllUsers
Install-Module -Name Microsoft.PowerShell.PSResourceGet -RequiredVersion $PsrgPinnedVer -Force -AllowPrerelease
}
elseif ($PSResourceGetMetadata.Version -gt $PsrgPinnedVerShort) {
Write-Warning -Message "'Microsoft.PowerShell.PSResourceGet' is higher than the pinned version of '$PsrgPinnedVer'. This may cause unexpected results. Consider opening a GitHub issue at 'https://github.com/natescherer/devcontainers-custom-features/issues' regarding this."
Write-Warning -Message "'Microsoft.PowerShell.PSResourceGet' is higher than the pinned version of '$PsrgPinnedVer'. This may cause unexpected results. Consider opening a GitHub issue at 'https://github.com/natescherer/publish-powershell-action/issues' regarding this."
}
elseif ($PSResourceGetMetadata.Version -lt $PsrgPinnedVerShort) {
Write-Host "'Microsoft.PowerShell.PSResourceGet' is less than the pinned version of '$PsrgPinnedVer'. Now updating..."
Install-Module -Name Microsoft.PowerShell.PSResourceGet -RequiredVersion $PsrgPinnedVer -Force -AllowPrerelease -Scope AllUsers
Install-Module -Name Microsoft.PowerShell.PSResourceGet -RequiredVersion $PsrgPinnedVer -Force -AllowPrerelease
}
elseif ($PSResourceGetMetadata.Version -eq $PsrgPinnedVerShort) {
Write-Host "'Microsoft.PowerShell.PSResourceGet' is already at pinned version of '$PsrgPinnedVer'."
}
else {
throw "Something went wrong while ensuring 'Microsoft.PowerShell.PSResourceGet' is installed. Consider opening a GitHub issue at 'https://github.com/natescherer/devcontainers-custom-features/issues' regarding this."
throw "Something went wrong while ensuring 'Microsoft.PowerShell.PSResourceGet' is installed. Consider opening a GitHub issue at 'https://github.com/natescherer/publish-powershell-action/issues' regarding this."
}

$FullPath = "$env:GITHUB_WORKSPACE\$env:INPUT_PATH"
Expand Down

0 comments on commit ad7a12e

Please sign in to comment.