Compare commits

..

6 Commits

Author SHA1 Message Date
ccf2c627fe Bump version to 2.35.2 2025-07-29 19:08:58 +05:30
2a597f617d Fix race condition 2025-07-29 02:08:56 +05:30
2282b6a082 Bump version to 2.35.1 2025-07-28 20:33:43 +05:30
11373c6dce Fix shellcheck in add_tools.sh [skip ci] 2025-07-28 20:13:02 +05:30
50ad25710d Use auth.json for composer authentication 2025-07-28 20:11:02 +05:30
c1c6c51867 Update geos patch [skip ci] 2025-07-28 17:22:40 +05:30
5 changed files with 63 additions and 7 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "setup-php",
"version": "2.35.0",
"version": "2.35.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-php",
"version": "2.35.0",
"version": "2.35.2",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.11.1",

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.35.0",
"version": "2.35.2",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js",

View File

@ -1,7 +1,11 @@
patch_geos() {
if [ "$(php -r "echo PHP_VERSION_ID;")" -ge 70000 ]; then
php_version_id="$(php -r "echo PHP_VERSION_ID;")"
if [ "$php_version_id" -ge 70000 ]; then
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
fi
if [ "$php_version_id" -ge 80500 ]; then
sed -i~ -e "s/zend_exception_get_default(TSRMLS_C)/zend_ce_exception/" geos.c
fi
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
patch -p1 < /tmp/php8.patch 2>/dev/null || true

View File

@ -28,6 +28,39 @@ Function Edit-ComposerConfig() {
Set-ComposerAuth
}
# Function to update auth.json.
Function Update-AuthJson {
[CmdletBinding()]
param(
[Parameter(Mandatory)][string[]] $ComposerAuth
)
if (Test-Path $composer_home\auth.json) {
try {
$existing = Get-Content $composer_home\auth.json -Raw | ConvertFrom-Json
} catch {
$existing = [PSCustomObject]@{}
}
} else {
$existing = [PSCustomObject]@{}
}
foreach ($fragment in $ComposerAuth) {
$piece = ('{' + $fragment + '}') | ConvertFrom-Json
foreach ($prop in $piece.PSObject.Properties) {
if ($prop.Name -eq 'http-basic') {
if (-not $existing.'http-basic') {
$existing | Add-Member -MemberType NoteProperty -Name 'http-basic' -Value ([PSCustomObject]@{}) -Force
}
foreach ($domainProp in $prop.Value.PSObject.Properties) {
$existing.'http-basic' | Add-Member -MemberType NoteProperty -Name $domainProp.Name -Value $domainProp.Value -Force
}
} else {
$existing | Add-Member -MemberType NoteProperty -Name $prop.Name -Value $prop.Value -Force
}
}
}
Set-Content -Path $composer_home\auth.json -Value ($existing | ConvertTo-Json -Depth 5)
}
# Function to setup authentication in composer.
Function Set-ComposerAuth() {
if(Test-Path env:COMPOSER_AUTH_JSON) {
@ -48,7 +81,7 @@ Function Set-ComposerAuth() {
$composer_auth += '"github-oauth": {"github.com": "' + $env:GITHUB_TOKEN + '"}'
}
if($composer_auth.length) {
Add-Env COMPOSER_AUTH ('{' + ($composer_auth -join ',') + '}')
Update-AuthJson $composer_auth
}
}

View File

@ -11,7 +11,7 @@ get_tool_version() {
alp="[a-zA-Z0-9\.]"
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
if [ "$tool" = "composer" ]; then
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "${tool_path_dir:?}/composer" | grep -Eo "$version_regex")"
if [[ -n "$composer_alias_version" ]]; then
composer_version="$composer_alias_version+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$alp+" | tail -n 1)"
else
@ -46,6 +46,25 @@ configure_composer() {
set_composer_auth
}
# Function to merge auth.json fragments.
update_auth_json() {
local auth_file="$composer_home/auth.json"
local merged
[[ -f "$auth_file" ]] && merged=$(<"$auth_file") || merged='{}'
for frag in "$@"; do
local obj="{$frag}"
merged=$(jq -n --argjson b "$merged" --argjson n "$obj" '
if $n|has("http-basic") then
(($b["http-basic"]//{}) + $n["http-basic"]) as $hb
| ($b + $n) | .["http-basic"] = $hb
else
$b + $n
end
')
done
printf '%s' "$merged" > "$composer_home/auth.json"
}
# Function to setup authentication in composer.
set_composer_auth() {
if [ -n "$COMPOSER_AUTH_JSON" ]; then
@ -63,7 +82,7 @@ set_composer_auth() {
composer_auth+=( '"github-oauth": {"github.com": "'"${GITHUB_TOKEN:-$COMPOSER_TOKEN}"'"}' )
fi
if ((${#composer_auth[@]})); then
add_env COMPOSER_AUTH "{$(IFS=$','; echo "${composer_auth[*]}")}"
update_auth_json "${composer_auth[@]}"
fi
}