mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Fix replacing v prefix in tool version
This commit is contained in:
parent
dd591f1661
commit
60ff774608
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -497,10 +497,8 @@ const utils = __importStar(__nccwpck_require__(918));
|
|||||||
async function getToolVersion(version) {
|
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 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]$/;
|
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
||||||
version = version.replace(/[><=^]*/, '');
|
version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1');
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case version.charAt(0) == 'v':
|
|
||||||
return version.replace('v', '');
|
|
||||||
case composer_regex.test(version):
|
case composer_regex.test(version):
|
||||||
case semver_regex.test(version):
|
case semver_regex.test(version):
|
||||||
return version;
|
return version;
|
||||||
|
@ -10,10 +10,8 @@ export async function getToolVersion(version: string): Promise<string> {
|
|||||||
const semver_regex =
|
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-]+)*))?$/;
|
/^(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]$/;
|
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
||||||
version = version.replace(/[><=^]*/, '');
|
version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1');
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case version.charAt(0) == 'v':
|
|
||||||
return version.replace('v', '');
|
|
||||||
case composer_regex.test(version):
|
case composer_regex.test(version):
|
||||||
case semver_regex.test(version):
|
case semver_regex.test(version):
|
||||||
return version;
|
return version;
|
||||||
|
Loading…
Reference in New Issue
Block a user