diff --git a/dist/index.js b/dist/index.js index cd29be61..d0e5deba 100644 --- a/dist/index.js +++ b/dist/index.js @@ -497,10 +497,8 @@ const utils = __importStar(__nccwpck_require__(918)); async function getToolVersion(version) { const semver_regex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/; - version = version.replace(/[><=^]*/, ''); + version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1'); switch (true) { - case version.charAt(0) == 'v': - return version.replace('v', ''); case composer_regex.test(version): case semver_regex.test(version): return version; diff --git a/src/tools.ts b/src/tools.ts index 8447cca1..5ea14259 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -10,10 +10,8 @@ export async function getToolVersion(version: string): Promise { const semver_regex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/; - version = version.replace(/[><=^]*/, ''); + version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1'); switch (true) { - case version.charAt(0) == 'v': - return version.replace('v', ''); case composer_regex.test(version): case semver_regex.test(version): return version;