add detection for ghrel prerelease

This commit is contained in:
crazywhalecc 2023-10-18 10:55:57 +08:00 committed by Jerry Ma
parent dbb566ac7c
commit e0e3bc6d97

View File

@ -99,12 +99,18 @@ class Downloader
hooks: [[CurlHook::class, 'setupGithubToken']], hooks: [[CurlHook::class, 'setupGithubToken']],
), true); ), true);
$url = null; $url = null;
foreach ($data[0]['assets'] as $asset) { foreach ($data as $release) {
if (preg_match('|' . $source['match'] . '|', $asset['name'])) { if ($release['prerelease'] === true) {
$url = $asset['browser_download_url']; continue;
break; }
foreach ($release['assets'] as $asset) {
if (preg_match('|' . $source['match'] . '|', $asset['name'])) {
$url = $asset['browser_download_url'];
break 2;
}
} }
} }
if (!$url) { if (!$url) {
throw new DownloaderException("failed to find {$name} source"); throw new DownloaderException("failed to find {$name} source");
} }