mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Use GitHub releases for phive's latest version
This commit is contained in:
parent
1b4cc0b6fa
commit
15b20027cf
@ -227,7 +227,7 @@ describe('Tools tests', () => {
|
||||
|
||||
it.each`
|
||||
version | php_version | os_version | script
|
||||
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://phar.io/releases/phive.phar phive'}
|
||||
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive'}
|
||||
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
||||
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
||||
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
||||
@ -238,7 +238,6 @@ describe('Tools tests', () => {
|
||||
async ({version, php_version, os_version, script}) => {
|
||||
const data = getData({
|
||||
tool: 'phive',
|
||||
domain: 'https://phar.io',
|
||||
repository: 'phar-io/phive',
|
||||
version_parameter: 'status',
|
||||
version: version,
|
||||
@ -391,7 +390,7 @@ describe('Tools tests', () => {
|
||||
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
||||
'add_composertool phinx phinx robmorgan/',
|
||||
'add_composertool phinx phinx:1.2.3 robmorgan/',
|
||||
'add_tool https://phar.io/releases/phive.phar phive "status"',
|
||||
'add_tool https://github.com/phar-io/phive/releases/download/3.2.1/phive-3.2.1.phar phive "status"',
|
||||
'add_composertool phpunit-bridge phpunit-bridge symfony/',
|
||||
'add_composertool phpunit-polyfills phpunit-polyfills yoast/',
|
||||
'add_devtools php-config',
|
||||
|
22
dist/index.js
vendored
22
dist/index.js
vendored
@ -724,26 +724,24 @@ async function addPhive(data) {
|
||||
case /5\.[3-5]/.test(data['php_version']):
|
||||
return await utils.addLog('$cross', 'phive', 'Phive is not supported on PHP ' + data['php_version'], data['os_version']);
|
||||
case /5\.6|7\.0/.test(data['php_version']):
|
||||
data['version'] = data['version'].replace('latest', '0.12.1');
|
||||
data['version'] = '0.12.1';
|
||||
break;
|
||||
case /7\.1/.test(data['php_version']):
|
||||
data['version'] = data['version'].replace('latest', '0.13.5');
|
||||
data['version'] = '0.13.5';
|
||||
break;
|
||||
case /7\.2/.test(data['php_version']):
|
||||
data['version'] = data['version'].replace('latest', '0.14.5');
|
||||
data['version'] = '0.14.5';
|
||||
break;
|
||||
}
|
||||
if (data['version'] === 'latest') {
|
||||
data['domain'] = data['domain'] + '/releases';
|
||||
}
|
||||
else {
|
||||
data['domain'] = [
|
||||
data['github'],
|
||||
data['repository'],
|
||||
'releases/download',
|
||||
data['version']
|
||||
].join('/');
|
||||
data['version'] = await getLatestVersion(data);
|
||||
}
|
||||
data['domain'] = [
|
||||
data['github'],
|
||||
data['repository'],
|
||||
'releases/download',
|
||||
data['version']
|
||||
].join('/');
|
||||
data['url'] = await getPharUrl(data);
|
||||
return await addArchive(data);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@
|
||||
"phive": {
|
||||
"type": "custom-function",
|
||||
"repository": "phar-io/phive",
|
||||
"domain": "https://phar.io",
|
||||
"domain": "https://github.com",
|
||||
"function": "phive",
|
||||
"version_prefix": "",
|
||||
"version_parameter": "status"
|
||||
|
21
src/tools.ts
21
src/tools.ts
@ -319,25 +319,24 @@ export async function addPhive(data: RS): Promise<string> {
|
||||
data['os_version']
|
||||
);
|
||||
case /5\.6|7\.0/.test(data['php_version']):
|
||||
data['version'] = data['version'].replace('latest', '0.12.1');
|
||||
data['version'] = '0.12.1';
|
||||
break;
|
||||
case /7\.1/.test(data['php_version']):
|
||||
data['version'] = data['version'].replace('latest', '0.13.5');
|
||||
data['version'] = '0.13.5';
|
||||
break;
|
||||
case /7\.2/.test(data['php_version']):
|
||||
data['version'] = data['version'].replace('latest', '0.14.5');
|
||||
data['version'] = '0.14.5';
|
||||
break;
|
||||
}
|
||||
if (data['version'] === 'latest') {
|
||||
data['domain'] = data['domain'] + '/releases';
|
||||
} else {
|
||||
data['domain'] = [
|
||||
data['github'],
|
||||
data['repository'],
|
||||
'releases/download',
|
||||
data['version']
|
||||
].join('/');
|
||||
data['version'] = await getLatestVersion(data);
|
||||
}
|
||||
data['domain'] = [
|
||||
data['github'],
|
||||
data['repository'],
|
||||
'releases/download',
|
||||
data['version']
|
||||
].join('/');
|
||||
data['url'] = await getPharUrl(data);
|
||||
return await addArchive(data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user