mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve Get-PhalconReleaseAssetUrl
This commit is contained in:
parent
9114b007ae
commit
a1e6789a94
@ -8,18 +8,21 @@ Function Get-PhalconReleaseAssetUrl() {
|
|||||||
)
|
)
|
||||||
$domain = 'https://api.github.com/repos'
|
$domain = 'https://api.github.com/repos'
|
||||||
$releases = 'phalcon/cphalcon/releases'
|
$releases = 'phalcon/cphalcon/releases'
|
||||||
|
if($extension_version -match '[3-4]') {
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||||
$match = $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
try {
|
||||||
if($NULL -eq $match) {
|
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||||
|
} catch {
|
||||||
$match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
$match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||||
}
|
}
|
||||||
if($NULL -eq $match) {
|
} else {
|
||||||
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
||||||
|
try {
|
||||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||||
}
|
} catch {
|
||||||
if($NULL -eq $match) {
|
|
||||||
$match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
$match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if($NULL -ne $match) {
|
if($NULL -ne $match) {
|
||||||
return "$github/$releases/download/v$Semver/$($match.Matches[0].Groups[1].Value)"
|
return "$github/$releases/download/v$Semver/$($match.Matches[0].Groups[1].Value)"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user