mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 15:26:23 +07:00 
			
		
		
		
	Fix version change if composer is a dependency
This commit is contained in:
		| @ -124,7 +124,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 | ||||
| @ -176,6 +176,9 @@ add_composertool() { | ||||
|     composer global require "$prefix$release" >/dev/null 2>&1 && | ||||
|     add_log "$tick" "$tool" "Added" | ||||
|   ) || 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 configure PECL | ||||
| @ -219,6 +222,7 @@ version=$1 | ||||
| dist=$2 | ||||
| tool_path_dir="/usr/local/bin" | ||||
| curl_opts=(-sL) | ||||
| composer_bin="$HOME/.composer/vendor/bin" | ||||
| existing_version=$(php-config --version 2>/dev/null | cut -c 1-3) | ||||
|  | ||||
| # Setup PHP | ||||
| @ -234,7 +238,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" "$HOME/.composer" | ||||
| semver=$(php -v | head -n 1 | cut -f 2 -d ' ') | ||||
| configure_pecl | ||||
| sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/" | ||||
|  | ||||
| @ -155,7 +155,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 | ||||
| @ -203,6 +203,9 @@ add_composertool() { | ||||
|     composer global require "$prefix$release" >/dev/null 2>&1 && | ||||
|     add_log "$tick" "$tool" "Added" | ||||
|   ) || 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 | ||||
| @ -259,11 +262,12 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive" | ||||
| apt_install="sudo $debconf_fix apt-fast install -y" | ||||
| tool_path_dir="/usr/local/bin" | ||||
| curl_opts=(-sL) | ||||
| composer_bin="$HOME/.composer/vendor/bin" | ||||
| existing_version=$(php-config --version 2>/dev/null | cut -c 1-3) | ||||
|  | ||||
| # Setup PHP | ||||
| step_log "Setup PHP" | ||||
| sudo mkdir -p /var/run /run/php | ||||
| sudo mkdir -m 777 -p "$HOME/.composer" /var/run /run/php | ||||
| . /etc/lsb-release | ||||
| if [ "$DISTRIB_RELEASE" = "20.04" ]; then | ||||
|   if ! apt-cache policy | grep -q ondrej/php; then | ||||
|  | ||||
| @ -148,7 +148,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 | ||||
|   } | ||||
| @ -227,6 +227,9 @@ Function Add-Composertool() { | ||||
|   } else { | ||||
|     Add-Log $cross $tool "Could not setup $tool" | ||||
|   } | ||||
|   if(Test-Path $composer_bin\composer) { | ||||
|     Copy-Item -Path "$php_dir\composer" -Destination "$composer_bin\composer" -Force | ||||
|   } | ||||
| } | ||||
|  | ||||
| Function Add-Pecl() { | ||||
| @ -240,6 +243,7 @@ $php_dir = 'C:\tools\php' | ||||
| $ext_dir = "$php_dir\ext" | ||||
| $current_profile = "$PSHOME\Profile.ps1" | ||||
| $ProgressPreference = 'SilentlyContinue' | ||||
| $composer_bin = "$env:APPDATA\Composer\vendor\bin" | ||||
| $master_version = '8.0' | ||||
| $arch = 'x64' | ||||
| $ts = $env:PHPTS -eq 'ts' | ||||
| @ -285,4 +289,5 @@ Set-PhpIniKey -Key 'memory_limit' -Value '-1' -Path $php_dir | ||||
| Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir | ||||
| Update-PhpCAInfo -Path $php_dir -Source CurrentUser | ||||
| 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)" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur