@@ -6,33 +6,45 @@ Function Add-PhalconFromGitHub() {
6
6
[string ]
7
7
$Semver
8
8
)
9
- $domain = ' https://github.com'
9
+ $domain = ' https://api. github.com/repos '
10
10
$nts = if (! $installed.ThreadSafe ) { " _nts" } else { " " }
11
- $match = Invoke-WebRequest - Uri " $domain /phalcon/cphalcon/releases/v$Semver " | Select-String - Pattern " href= `" (.*phalcon_x64_ .*_php${version} _${extension_version} .*[0-9]${nts} .zip)`" "
11
+ $match = $match = ( Invoke-RestMethod - Uri " $domain /phalcon/cphalcon/releases/tags/ v$Semver " ).assets | Select-String - Pattern " browser_download_url= (.*phalcon_ ${arch} _ .*_php${version} _${extension_version} .*[0-9]${nts} .zip)"
12
12
if ($NULL -eq $match ) {
13
13
$nts = if (! $installed.ThreadSafe ) { " -nts" } else { " -ts" }
14
- $match = Invoke-WebRequest - Uri " $domain /phalcon/cphalcon/releases/v$Semver " | Select-String - Pattern " href= `" (.*phalcon-php${version}${nts} -windows.*-x64.zip)`" "
14
+ $match = ( Invoke-RestMethod - Uri " $domain /phalcon/cphalcon/releases/tags/ v$Semver " ).assets | Select-String - Pattern " browser_download_url= (.*phalcon-php${version}${nts} -windows.*-x64.zip)"
15
15
}
16
16
if ($NULL -ne $match ) {
17
- $zip_file = $match.Matches [0 ].Groups[1 ].Value
18
- Invoke-WebRequest - Uri $domain / $zip_file - OutFile $ENV: RUNNER_TOOL_CACHE \phalcon.zip > $null 2>&1
17
+ $zip_url = $match.Matches [0 ].Groups[1 ].Value
18
+ Invoke-WebRequest - Uri $zip_url - OutFile $ENV: RUNNER_TOOL_CACHE \phalcon.zip > $null 2>&1
19
19
Expand-Archive - Path $ENV: RUNNER_TOOL_CACHE \phalcon.zip - DestinationPath $ENV: RUNNER_TOOL_CACHE \phalcon - Force > $null 2>&1
20
20
Copy-Item - Path " $ENV: RUNNER_TOOL_CACHE \phalcon\php_phalcon.dll" - Destination " $ext_dir \php_phalcon.dll"
21
21
Enable-PhpExtension - Extension phalcon - Path $php_dir
22
22
} else {
23
23
throw " Unable to get Phalcon release from the GitHub release"
24
24
}
25
25
}
26
+
27
+ # Function to get phalcon semver.
28
+ Function Get-PhalconSemver () {
29
+ if ($extension_version -eq ' 3' ) {
30
+ return ' 3.4.5'
31
+ } elseif (($extension_version -eq ' 4' ) -and ($version -eq ' 7.2' )) {
32
+ return ' 4.1.0'
33
+ }
34
+ return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object - First 1
35
+ }
36
+
26
37
# Function to install phalcon
27
38
Function Add-PhalconHelper () {
28
- if (( $extension_version -eq ' 4 ' ) -or ( $extension_version -eq ' 5 ' )) {
29
- $extension_semver = Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object - First 1
30
- Add-Extension - Extension phalcon - Stability stable - Extension_version $extension_semver
31
- } elseif ($extension_version -eq ' 3 ' ) {
32
- Add-PhalconFromGitHub - Semver 3.4 . 5
39
+ $semver = Get-PhalconSemver
40
+ if (( $extension_version -eq ' 3 ' ) -or ( $extension_version -eq ' 5 ' )) {
41
+ Add-PhalconFromGitHub $semver
42
+ } elseif ($extension_version -eq ' 4 ' ) {
43
+ Add-Extension - Extension phalcon - Stability stable - Extension_version $semver
33
44
}
34
45
}
35
46
47
+ # Function to add phalcon
36
48
Function Add-Phalcon () {
37
49
Param (
38
50
[Parameter (Position = 0 , Mandatory = $true )]
0 commit comments