mirror of
https://gitea.com/actions/setup-java.git
synced 2026-07-10 19:31:55 +08:00
Support pinning java-version as "latest"
Add a `latest` alias for the `java-version` input that floats to the newest available stable (GA) release. It is normalized to the SemVer wildcard at the base-installer layer and always resolves from remote (like `check-latest: true`). List-based distributions resolve it automatically via the existing newest-first matching. Corretto selects its newest available major; Oracle and GraalVM look up the newest GA major via the Adoptium API and request it, failing with an actionable error if that major isn't published yet. The jdkfile distribution rejects `latest`. Closes #832 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
16
dist/cleanup/index.js
vendored
16
dist/cleanup/index.js
vendored
@@ -96154,6 +96154,22 @@ function renameWinArchive(javaArchivePath) {
|
||||
fs.renameSync(javaArchivePath, javaArchivePathRenamed);
|
||||
return javaArchivePathRenamed;
|
||||
}
|
||||
// Resolve the newest available stable/GA feature (major) release.
|
||||
//
|
||||
// Some distributions (e.g. Oracle, GraalVM) construct their download URLs from a
|
||||
// concrete major version and don't expose an endpoint to list every available
|
||||
// release, so a bare `latest` alias can't be resolved from their own metadata.
|
||||
// The Adoptium (Temurin) API is used as a proxy for "what is the newest GA major
|
||||
// version out there", which those distributions typically publish at the same time.
|
||||
async function getLatestMajorVersion(http) {
|
||||
const availableReleasesUrl = 'https://api.adoptium.net/v3/info/available_releases';
|
||||
const response = await http.getJson(availableReleasesUrl);
|
||||
const mostRecent = response.result?.most_recent_feature_release;
|
||||
if (!mostRecent || Number.isNaN(Number(mostRecent))) {
|
||||
throw new Error(`Could not determine the latest available Java major version from ${availableReleasesUrl}`);
|
||||
}
|
||||
return Number(mostRecent);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./src/gpg.ts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user