mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Fix version change if composer is a dependency
This commit is contained in:
parent
04a9e3b562
commit
2c29e8b9a1
@ -153,7 +153,7 @@ configure_composer() {
|
||||
exit 1
|
||||
fi
|
||||
composer -q global config process-timeout 0
|
||||
echo "/Users/$USER/.composer/vendor/bin" >> "$GITHUB_PATH"
|
||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||
fi
|
||||
@ -229,6 +229,9 @@ add_composertool() {
|
||||
tool_version=$(get_tool_version 'echo' "$json") &&
|
||||
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||
if [ -e "$composer_bin/composer" ]; then
|
||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to handle request to add phpize and php-config.
|
||||
@ -285,6 +288,7 @@ fail_fast=$3
|
||||
nodot_version=${1/./}
|
||||
nightly_versions="8.[0-1]"
|
||||
old_versions="5.[3-5]"
|
||||
composer_bin="/Users/$USER/.composer/vendor/bin"
|
||||
tool_path_dir="/usr/local/bin"
|
||||
curl_opts=(-sL)
|
||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||
@ -318,7 +322,7 @@ sudo chmod 777 "$ini_file" "$tool_path_dir"
|
||||
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
|
||||
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
sudo mkdir -p "$ext_dir"
|
||||
sudo mkdir -m 777 -p "$ext_dir" "/Users/$USER/.composer"
|
||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
|
||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||
|
@ -252,7 +252,7 @@ configure_composer() {
|
||||
exit 1;
|
||||
fi
|
||||
composer -q global config process-timeout 0
|
||||
echo "/home/$USER/.composer/vendor/bin" >> "$GITHUB_PATH"
|
||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||
fi
|
||||
@ -326,6 +326,9 @@ add_composertool() {
|
||||
tool_version=$(get_tool_version 'echo' "$json") &&
|
||||
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||
if [ -e "$composer_bin/composer" ]; then
|
||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to setup phpize and php-config.
|
||||
@ -430,6 +433,7 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
github="https://github.com/shivammathur"
|
||||
apt_install="sudo $debconf_fix apt-get install -y"
|
||||
apt_remove="sudo $debconf_fix apt-get remove -y"
|
||||
composer_bin="/home/$USER/.composer/vendor/bin"
|
||||
tool_path_dir="/usr/local/bin"
|
||||
curl_opts=(-sL)
|
||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||
@ -446,7 +450,7 @@ fi
|
||||
|
||||
# Setup PHP
|
||||
step_log "Setup PHP"
|
||||
sudo mkdir -p /var/run /run/php
|
||||
sudo mkdir -m 777 -p /home/"$USER"/.composer /var/run /run/php
|
||||
if [ "$existing_version" != "$version" ]; then
|
||||
if [ ! -e "/usr/bin/php$version" ]; then
|
||||
add_php >/dev/null 2>&1
|
||||
|
@ -197,7 +197,7 @@ Function Edit-ComposerConfig() {
|
||||
exit 1;
|
||||
}
|
||||
composer -q global config process-timeout 0
|
||||
Write-Output "$env:APPDATA\Composer\vendor\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
if (Test-Path env:COMPOSER_TOKEN) {
|
||||
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
||||
}
|
||||
@ -297,6 +297,9 @@ Function Add-Composertool() {
|
||||
)
|
||||
composer global require $prefix$release 2>&1 | out-null
|
||||
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
||||
if(Test-Path $composer_bin\composer) {
|
||||
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
||||
}
|
||||
if($json) {
|
||||
$tool_version = Get-ToolVersion "Write-Output" "$json"
|
||||
Add-Log $tick $tool "Added $tool $tool_version"
|
||||
@ -316,6 +319,7 @@ $cross = ([char]10007)
|
||||
$php_dir = 'C:\tools\php'
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$bin_dir = $php_dir
|
||||
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
||||
$current_profile = "$env:TEMP\setup-php.ps1"
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$nightly_version = '8.[0-9]'
|
||||
@ -401,4 +405,5 @@ if($version -lt "5.5") {
|
||||
}
|
||||
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
||||
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||
New-Item -ItemType Directory -Path $composer_bin -Force 2>&1 | Out-Null
|
||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||
|
Loading…
Reference in New Issue
Block a user