mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Run New-Item with -Force as items can pre-exist on self-hosted environments
Pipe output to $null as that is removed for verbose and not Out-Null, and is also faster
This commit is contained in:
parent
ed62711289
commit
f6b4601c63
@ -31,7 +31,7 @@ Function Repair-ICU() {
|
|||||||
}
|
}
|
||||||
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
||||||
if ($zip_url -ne '') {
|
if ($zip_url -ne '') {
|
||||||
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" | Out-Null
|
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" -Force > $null 2>&1
|
||||||
Invoke-WebRequest -Uri $zip_url -OutFile "$php_dir\icu\icu.zip"
|
Invoke-WebRequest -Uri $zip_url -OutFile "$php_dir\icu\icu.zip"
|
||||||
Expand-Archive -Path $php_dir\icu\icu.zip -DestinationPath $php_dir\icu -Force
|
Expand-Archive -Path $php_dir\icu\icu.zip -DestinationPath $php_dir\icu -Force
|
||||||
Get-ChildItem $php_dir\icu\bin -Filter *.dll | Copy-Item -Destination $php_dir -Force
|
Get-ChildItem $php_dir\icu\bin -Filter *.dll | Copy-Item -Destination $php_dir -Force
|
||||||
|
@ -74,20 +74,20 @@ Function Add-Path {
|
|||||||
Function Add-Printf {
|
Function Add-Printf {
|
||||||
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
||||||
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
||||||
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
|
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe -Force > $null 2>&1
|
||||||
} else {
|
} else {
|
||||||
Invoke-WebRequest -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
Invoke-WebRequest -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
||||||
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe"
|
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe" -Force > $null 2>&1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get a clean Powershell profile.
|
# Function to get a clean Powershell profile.
|
||||||
Function Get-CleanPSProfile {
|
Function Get-CleanPSProfile {
|
||||||
if(-not(Test-Path -LiteralPath $profile)) {
|
if(-not(Test-Path -LiteralPath $profile)) {
|
||||||
New-Item -Path $profile -ItemType "file" -Force
|
New-Item -Path $profile -ItemType "file" -Force > $null 2>&1
|
||||||
}
|
}
|
||||||
Set-Content $current_profile -Value ''
|
Set-Content $current_profile -Value ''
|
||||||
Add-ToProfile $profile $current_profile.replace('\', '\\') ". $current_profile"
|
Add-ToProfile $profile $current_profile.replace('\', '\\') ". $current_profile"
|
||||||
@ -154,7 +154,7 @@ Function Get-ExtensionPrerequisites{
|
|||||||
)
|
)
|
||||||
$deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
|
$deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
|
||||||
$extensions_with_dependencies = ('imagick')
|
$extensions_with_dependencies = ('imagick')
|
||||||
New-Item $deps_dir -Type Directory 2>&1 | Out-Null
|
New-Item $deps_dir -Type Directory -Force > $null 2>&1
|
||||||
if($extensions_with_dependencies.Contains($extension)) {
|
if($extensions_with_dependencies.Contains($extension)) {
|
||||||
Install-PhpExtensionPrerequisite -Extension $extension -InstallPath $deps_dir -PhpPath $php_dir
|
Install-PhpExtensionPrerequisite -Extension $extension -InstallPath $deps_dir -PhpPath $php_dir
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ if($env:RUNNER -eq 'self-hosted') {
|
|||||||
$ext_dir = "$php_dir\ext"
|
$ext_dir = "$php_dir\ext"
|
||||||
$cert_source='Curl'
|
$cert_source='Curl'
|
||||||
Get-CleanPSProfile >$null 2>&1
|
Get-CleanPSProfile >$null 2>&1
|
||||||
New-Item $bin_dir -Type Directory 2>&1 | Out-Null
|
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $bin_dir
|
Add-Path -PathItem $bin_dir
|
||||||
if($version -lt 5.6) {
|
if($version -lt 5.6) {
|
||||||
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
@ -424,7 +424,7 @@ if($env:RUNNER -eq 'self-hosted') {
|
|||||||
if ((Get-InstalledModule).Name -notcontains 'VcRedist') {
|
if ((Get-InstalledModule).Name -notcontains 'VcRedist') {
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
}
|
}
|
||||||
New-Item $php_dir -Type Directory 2>&1 | Out-Null
|
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $php_dir
|
Add-Path -PathItem $php_dir
|
||||||
setx PHPROOT $php_dir >$null 2>&1
|
setx PHPROOT $php_dir >$null 2>&1
|
||||||
} else {
|
} else {
|
||||||
@ -489,6 +489,6 @@ if($version -lt "5.5") {
|
|||||||
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
||||||
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
||||||
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
New-Item -ItemType Directory -Path $composer_bin -Force 2>&1 | Out-Null
|
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
|
||||||
Write-Output "::set-output name=php-version::$($installed.FullVersion)"
|
Write-Output "::set-output name=php-version::$($installed.FullVersion)"
|
||||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version"
|
||||||
|
Loading…
Reference in New Issue
Block a user