mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[Windows] Implement new directories hierarchy (#8616)
This commit is contained in:
committed by
GitHub
parent
84a7deae24
commit
d1f2c9a3be
38
images/windows/scripts/build/Configure-PowerShell.ps1
Normal file
38
images/windows/scripts/build/Configure-PowerShell.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
################################################################################
|
||||
## File: Configure-Powershell.ps1
|
||||
## Desc: Manage PowerShell configuration
|
||||
################################################################################
|
||||
|
||||
#region System
|
||||
Write-Host "Setup PowerShellGet"
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
|
||||
# Specifies the installation policy
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
|
||||
Write-Host 'Warmup PSModuleAnalysisCachePath (speedup first powershell invocation by 20s)'
|
||||
$PSModuleAnalysisCachePath = 'C:\PSModuleAnalysisCachePath\ModuleAnalysisCache'
|
||||
|
||||
[Environment]::SetEnvironmentVariable('PSModuleAnalysisCachePath', $PSModuleAnalysisCachePath, [System.EnvironmentVariableTarget]::Machine)
|
||||
# make variable to be available in the current session
|
||||
${env:PSModuleAnalysisCachePath} = $PSModuleAnalysisCachePath
|
||||
|
||||
$null = New-Item -Path $PSModuleAnalysisCachePath -ItemType 'File' -Force
|
||||
#endregion
|
||||
|
||||
#region User (current user, image generation only)
|
||||
if (-not (Test-Path $profile)) {
|
||||
New-Item $profile -ItemType File -Force
|
||||
}
|
||||
|
||||
@"
|
||||
if ( -not(Get-Module -ListAvailable -Name PowerHTML)) {
|
||||
Install-Module PowerHTML -Scope CurrentUser
|
||||
}
|
||||
|
||||
if ( -not(Get-Module -Name PowerHTML)) {
|
||||
Import-Module PowerHTML
|
||||
}
|
||||
"@ | Add-Content -Path $profile -Force
|
||||
|
||||
#endregion
|
||||
Reference in New Issue
Block a user