mirror of
https://github.com/actions/setup-java.git
synced 2025-05-21 09:51:47 +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
@ -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. ```latest``` (same as ```x```)
|
||||
|
||||
- An early access (EA) Java version
|
||||
|
||||
e.g. ```14-ea, 15-ea```
|
||||
|
@ -271,6 +271,12 @@ function getDownloadInfo(
|
||||
}
|
||||
|
||||
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.') {
|
||||
// Trim leading 1. for versions like 1.8
|
||||
version = version.slice(2);
|
||||
|
Loading…
Reference in New Issue
Block a user