mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-31 18:57:17 +07:00
Fix tools.getLatestVersion
This commit is contained in:
15
dist/index.js
vendored
15
dist/index.js
vendored
@ -548,12 +548,15 @@ async function getLatestVersion(data) {
|
||||
return 'latest';
|
||||
}
|
||||
const resp = await utils.fetch(`${data['github']}/${data['repository']}/releases.atom`);
|
||||
const releases = [
|
||||
...resp['data'].matchAll(/releases\/tag\/([a-zA-Z]*)?(\d+.\d+.\d+)"/g)
|
||||
].map(match => match[2]);
|
||||
return (releases
|
||||
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }))
|
||||
.pop() || 'latest');
|
||||
if (resp['data']) {
|
||||
const releases = [
|
||||
...resp['data'].matchAll(/releases\/tag\/([a-zA-Z]*)?(\d+.\d+.\d+)"/g)
|
||||
].map(match => match[2]);
|
||||
return (releases
|
||||
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }))
|
||||
.pop() || 'latest');
|
||||
}
|
||||
return 'latest';
|
||||
}
|
||||
exports.getLatestVersion = getLatestVersion;
|
||||
async function getVersion(version, data) {
|
||||
|
Reference in New Issue
Block a user