diff --git a/dist/index.js b/dist/index.js index f14ace44..dbe3b8c5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -295,7 +295,7 @@ async function addExtensionWindows(extension_csv, version) { case /^(5\.[3-6]|7\.[0-4]|8\.1)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension): case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): - case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): + case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(version_extension): case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension): add_script += await utils.customPackage(ext_name, 'extensions', extension, 'win32'); return; diff --git a/src/extensions.ts b/src/extensions.ts index a6b2fe46..63b5814c 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -134,14 +134,16 @@ export async function addExtensionWindows( // match 5.3blackfire-(semver)...8.1blackfire-(semver) // match pdo_oci and oci8 // match 5.3ioncube...7.4ioncube - // match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4 + // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5 // match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http case /^(5\.[3-6]|7\.[0-4]|8\.1)blackfire(-\d+\.\d+\.\d+)?$/.test( version_extension ): case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): - case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): + case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test( + version_extension + ): case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension): add_script += await utils.customPackage( ext_name, diff --git a/src/scripts/extensions/phalcon.ps1 b/src/scripts/extensions/phalcon.ps1 index 5dcea56f..2b549af0 100644 --- a/src/scripts/extensions/phalcon.ps1 +++ b/src/scripts/extensions/phalcon.ps1 @@ -1,16 +1,36 @@ -# Function to install phalcon -Function Add-PhalconHelper() { - if ($extension_version -eq '4') { - Install-Phpextension -Extension phalcon -MinimumStability stable -Path $php_dir - } else { - $domain = 'https://github.com' - $nts = if (!$installed.ThreadSafe) { "_nts" } else { "" } - $match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v3.4.5" | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`"" +# Function to add phalcon using GitHub releases. +Function Add-PhalconFromGitHub() { + Param ( + [Parameter(Position = 0, Mandatory = $true)] + [ValidateNotNull()] + [string] + $Semver + ) + $domain = 'https://github.com' + $nts = if (!$installed.ThreadSafe) { "_nts" } else { "" } + $match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v$Semver" | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`"" + if($NULL -eq $match) { + $nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" } + $match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v$Semver" | Select-String -Pattern "href=`"(.*phalcon-php${version}${nts}-windows.*-x64.zip)`"" + } + if($NULL -ne $match) { $zip_file = $match.Matches[0].Groups[1].Value Invoke-WebRequest -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1 Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1 Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll" Enable-PhpExtension -Extension phalcon -Path $php_dir + } else { + throw "Unable to get Phalcon release from the GitHub release" + } +} +# Function to install phalcon +Function Add-PhalconHelper() { + if ($extension_version -eq '5') { + Add-PhalconFromGitHub -Semver (Get-PeclPackageVersion phalcon 5 snapshot stable | Select-Object -First 1) + } elseif ($extension_version -eq '4') { + Install-Phpextension -Extension phalcon -MinimumStability stable -Path $php_dir + } elseif ($extension_version -eq '3') { + Add-PhalconFromGitHub -Semver 3.4.5 } } @@ -18,7 +38,7 @@ Function Add-Phalcon() { Param ( [Parameter(Position = 0, Mandatory = $true)] [ValidateNotNull()] - [ValidateSet('phalcon3', 'phalcon4')] + [ValidateSet('phalcon3', 'phalcon4', 'phalcon5')] [string] $extension )