mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
Add 'latest' as alias for version 'x'
While it is possible to specify that you want the latest JDK version by using semver X-Ranges (like 'x' for example), 'latest' is more readable as explicitly states the intention.
This commit is contained in:
parent
5c87b70ffe
commit
3edd66d1b0
2 changed files with 8 additions and 0 deletions
|
@ -36,6 +36,8 @@ Examples of version specifications that the java-version parameter will accept:
|
||||||
|
|
||||||
e.g. ```8.0.x, >11.0.3, >=13.0.1, <8.0.212```
|
e.g. ```8.0.x, >11.0.3, >=13.0.1, <8.0.212```
|
||||||
|
|
||||||
|
e.g. ```latest``` (same as ```x```)
|
||||||
|
|
||||||
- An early access (EA) Java version
|
- An early access (EA) Java version
|
||||||
|
|
||||||
e.g. ```14-ea, 15-ea```
|
e.g. ```14-ea, 15-ea```
|
||||||
|
|
|
@ -271,6 +271,12 @@ function getDownloadInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeVersion(version: string): string {
|
function normalizeVersion(version: string): string {
|
||||||
|
// 'latest' means the most recent of any JDK version
|
||||||
|
// semver won't match pre-release versions
|
||||||
|
if (version === 'latest') {
|
||||||
|
version = 'x';
|
||||||
|
}
|
||||||
|
|
||||||
if (version.slice(0, 2) === '1.') {
|
if (version.slice(0, 2) === '1.') {
|
||||||
// Trim leading 1. for versions like 1.8
|
// Trim leading 1. for versions like 1.8
|
||||||
version = version.slice(2);
|
version = version.slice(2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue