mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Fix to not break existing tools if they fail to setup
This commit is contained in:
parent
092944b039
commit
3681a25ab6
@ -308,8 +308,8 @@ add_tool() {
|
|||||||
export PATH=$PATH:"$tool_path_dir"
|
export PATH=$PATH:"$tool_path_dir"
|
||||||
echo "export PATH=\$PATH:$tool_path_dir" | sudo tee -a "$GITHUB_ENV" >/dev/null
|
echo "export PATH=\$PATH:$tool_path_dir" | sudo tee -a "$GITHUB_ENV" >/dev/null
|
||||||
fi
|
fi
|
||||||
if [ ! -e "$tool_path" ]; then
|
if [ -e "$tool_path" ]; then
|
||||||
rm -rf "$tool_path"
|
sudo cp -a "$tool_path" /tmp/"$tool"
|
||||||
fi
|
fi
|
||||||
IFS="," read -r -a url <<<"$url"
|
IFS="," read -r -a url <<<"$url"
|
||||||
status_code=$(get -v -e "$tool_path" "${url[@]}")
|
status_code=$(get -v -e "$tool_path" "${url[@]}")
|
||||||
@ -322,7 +322,11 @@ add_tool() {
|
|||||||
tool_version=$(get_tool_version "$tool" "$ver_param")
|
tool_version=$(get_tool_version "$tool" "$ver_param")
|
||||||
add_log "$tick" "$tool" "Added $tool $tool_version"
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
else
|
else
|
||||||
[ "$tool" = "composer" ] && fail_fast=true
|
if [ "$tool" = "composer" ]; then
|
||||||
|
fail_fast=true
|
||||||
|
elif [ -e /tmp/"$tool" ]; then
|
||||||
|
sudo cp -a /tmp/"$tool" "$tool_path"
|
||||||
|
fi
|
||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ Function Add-Tool() {
|
|||||||
$ver_param
|
$ver_param
|
||||||
)
|
)
|
||||||
if (Test-Path $bin_dir\$tool) {
|
if (Test-Path $bin_dir\$tool) {
|
||||||
Remove-Item $bin_dir\$tool
|
Copy-Item $bin_dir\$tool -Destination $bin_dir\$tool.old -Force
|
||||||
}
|
}
|
||||||
if($url.Count -gt 1) {
|
if($url.Count -gt 1) {
|
||||||
$url = $url[0]
|
$url = $url[0]
|
||||||
@ -404,6 +404,8 @@ Function Add-Tool() {
|
|||||||
} else {
|
} else {
|
||||||
if($tool -eq "composer") {
|
if($tool -eq "composer") {
|
||||||
$env:fail_fast = 'true'
|
$env:fail_fast = 'true'
|
||||||
|
} elseif (Test-Path $bin_dir\$tool.old) {
|
||||||
|
Copy-Item $bin_dir\$tool.old -Destination $bin_dir\$tool -Force
|
||||||
}
|
}
|
||||||
Add-Log $cross $tool "Could not add $tool"
|
Add-Log $cross $tool "Could not add $tool"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user