mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-11-22 23:37:21 +07:00
Fix getcomposer fallback url for specific versions
This commit is contained in:
@ -383,8 +383,8 @@ describe('Tools tests', () => {
|
||||
${'preview'} | ${'7.1'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-preview.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||
${'1'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
||||
${'2'} | ${'7.1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.1-2.phar'} | ${'https://getcomposer.org/download/latest-2.2.x/composer.phar'}
|
||||
${'1.2.3'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
|
||||
${'1.2.3-RC1'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
|
||||
${'1.2.3'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/download/1.2.3/composer.phar'}
|
||||
${'1.2.3-RC1'} | ${'7.4'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/download/1.2.3-RC1/composer.phar'}
|
||||
`(
|
||||
'checking addComposer: $version, $php_version, $no_tool_cache',
|
||||
async ({version, php_version, no_tool_cache, cache_url, source_url}) => {
|
||||
|
||||
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -290,7 +290,8 @@ export async function addComposer(data: RS): Promise<string> {
|
||||
const spc_url = `${spc}/composer/${filename}`;
|
||||
const lts_url = `${getcomposer}/download/latest-2.2.x/composer.phar`;
|
||||
const is_lts = /^5\.[3-6]$|^7\.[0-1]$/.test(data['php_version']);
|
||||
const version_source_url = `${getcomposer}/composer-${channel}.phar`;
|
||||
const channel_source_url = `${getcomposer}/composer-${channel}.phar`;
|
||||
const version_source_url = `${getcomposer}/download/${channel}/composer.phar`;
|
||||
let cache_url = `${releases_url},${spc_url},${cds_url}`;
|
||||
let source_url = `${getcomposer}/composer.phar`;
|
||||
switch (true) {
|
||||
@ -298,17 +299,17 @@ export async function addComposer(data: RS): Promise<string> {
|
||||
source_url = is_lts ? lts_url : source_url;
|
||||
break;
|
||||
case /^preview$|^2$/.test(channel):
|
||||
source_url = is_lts ? lts_url : version_source_url;
|
||||
source_url = is_lts ? lts_url : channel_source_url;
|
||||
break;
|
||||
case /^1$/.test(channel):
|
||||
source_url = version_source_url;
|
||||
source_url = channel_source_url;
|
||||
break;
|
||||
case /^\d+\.\d+\.\d+[\w-]*$/.test(data['version']):
|
||||
cache_url = `${github}/${data['repository']}/releases/download/${data['version']}/composer.phar`;
|
||||
source_url = version_source_url;
|
||||
break;
|
||||
default:
|
||||
source_url = is_lts ? lts_url : version_source_url;
|
||||
source_url = is_lts ? lts_url : channel_source_url;
|
||||
}
|
||||
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
||||
data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
|
||||
|
||||
Reference in New Issue
Block a user