1
0
Fork 0
mirror of https://github.com/actions/setup-java.git synced 2024-08-16 10:19:51 +02:00

Merge pull request #35 from foo-actions/master

Add more robust support for EA version specification
This commit is contained in:
Konrad Pabjan 2019-12-31 00:25:51 -05:00 committed by GitHub
commit 0e40802452
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3019 additions and 3001 deletions

13
dist/index.js generated vendored
View file

@ -4643,8 +4643,17 @@ function normalizeVersion(version) {
throw new Error('1. is not a valid version'); throw new Error('1. is not a valid version');
} }
} }
// Add trailing .x if it is missing if (version.endsWith('-ea')) {
if (version.split('.').length != 3) { // convert e.g. 14-ea to 14.0.0-ea
if (version.indexOf('.') == -1) {
version = version.slice(0, version.length - 3) + '.0.0-ea';
}
// match anything in -ea.X (semver won't do .x matching on pre-release versions)
if (version[0] >= '0' && version[0] <= '9') {
version = '>=' + version;
}
} else if (version.split('.').length < 3) {
// For non-ea versions, add trailing .x if it is missing
if (version[version.length - 1] != 'x') { if (version[version.length - 1] != 'x') {
version = version + '.x'; version = version + '.x';
} }

View file

@ -266,8 +266,17 @@ function normalizeVersion(version: string): string {
} }
} }
// Add trailing .x if it is missing if (version.endsWith('-ea')) {
if (version.split('.').length != 3) { // convert e.g. 14-ea to 14.0.0-ea
if (version.indexOf('.') == -1) {
version = version.slice(0, version.length - 3) + '.0.0-ea';
}
// match anything in -ea.X (semver won't do .x matching on pre-release versions)
if (version[0] >= '0' && version[0] <= '9') {
version = '>=' + version;
}
} else if (version.split('.').length < 3) {
// For non-ea versions, add trailing .x if it is missing
if (version[version.length - 1] != 'x') { if (version[version.length - 1] != 'x') {
version = version + '.x'; version = version + '.x';
} }