Stop Intel macOS installs when the package cache fails

This commit is contained in:
Shivam Mathur
2026-09-09 09:01:18 +05:30
parent de306754b1
commit 63b8b6feda
+11 -5
View File
@@ -189,9 +189,9 @@ add_php() {
php_keg="php@$version$suffix" php_keg="php@$version$suffix"
php_formula="shivammathur/php/$php_keg" php_formula="shivammathur/php/$php_keg"
if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then
if [ "${runner:?}" != "self-hosted" ] && \ if [ "${runner:?}" != "self-hosted" ] && [ "${use_package_cache:-true}" != "false" ]; then
[ "${use_package_cache:-true}" != "false" ] && setup_cached_versions; then setup_cached_versions && return 0
return 0 [ "$(uname -m)" != "x86_64" ] || return 1
fi fi
update_dependencies update_dependencies
add_brew_tap "$php_tap" add_brew_tap "$php_tap"
@@ -264,12 +264,18 @@ setup_php() {
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1 run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
status="Installed" status="Installed"
elif [[ "${existing_version:0:3}" != "$version" || -n "$(get_php_formula_suffix)" ]]; then elif [[ "${existing_version:0:3}" != "$version" || -n "$(get_php_formula_suffix)" ]]; then
add_php "install" "$existing_version" >/dev/null 2>&1 add_php "install" "$existing_version" >/dev/null 2>&1 || {
add_log "${cross:?}" "PHP" "Could not install PHP $version"
exit 1
}
status="Installed" status="Installed"
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')" brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
if [ "$brew_php_version" != "$existing_version" ]; then if [ "$brew_php_version" != "$existing_version" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1 add_php "upgrade" "$existing_version" >/dev/null 2>&1 || {
add_log "${cross:?}" "PHP" "Could not upgrade PHP $version"
exit 1
}
status="Upgraded" status="Upgraded"
fi fi
fi fi