diff --git a/dist/main/index.js b/dist/main/index.js index 00b9347..7808bf3 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -70176,7 +70176,7 @@ function checkForUpdates(graalVMVersion, javaVersion) { if (graalVMVersion.length > 0 && (javaVersion === '17' || javaVersion === '19')) { const recommendedJDK = javaVersion === '17' ? '17' : '20'; - core.notice(`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Release notes: https://www.graalvm.org/release-notes/JDK_${recommendedJDK}/`); + core.notice(`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later`); return; } if (graalVMVersion.startsWith('22.3.') && javaVersion === '11') { @@ -70871,7 +70871,8 @@ function findLatestGraalVMJDKCEJavaVersion(majorJavaVersion) { const versionNumberStartIndex = `refs/tags/${GRAALVM_JDK_TAG_PREFIX}`.length; for (const matchingRef of matchingRefs) { const currentVersion = matchingRef.ref.substring(versionNumberStartIndex); - if ((0, semver_1.gt)(currentVersion, highestVersion)) { + if ((0, semver_1.valid)(currentVersion) && + (0, semver_1.gt)(currentVersion, highestVersion)) { highestVersion = currentVersion; } } @@ -71102,6 +71103,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const c = __importStar(__nccwpck_require__(9042)); const core = __importStar(__nccwpck_require__(2186)); const graalvm = __importStar(__nccwpck_require__(5254)); +const semver_1 = __nccwpck_require__(1383); const cache_1 = __nccwpck_require__(7799); const path_1 = __nccwpck_require__(1017); const cache_2 = __nccwpck_require__(9179); @@ -71162,7 +71164,8 @@ function run() { else { switch (graalvmVersion) { case c.VERSION_LATEST: - if (javaVersion.startsWith('17') || javaVersion.startsWith('20')) { + if (javaVersion.startsWith('17') || + ((0, semver_1.valid)(javaVersion) && (0, semver_1.gte)(javaVersion, '20'))) { core.info(`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`); graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion); } diff --git a/src/features/check-for-updates.ts b/src/features/check-for-updates.ts index 8dec9d4..4f50909 100644 --- a/src/features/check-for-updates.ts +++ b/src/features/check-for-updates.ts @@ -14,7 +14,7 @@ export async function checkForUpdates( ) { const recommendedJDK = javaVersion === '17' ? '17' : '20' core.notice( - `A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Release notes: https://www.graalvm.org/release-notes/JDK_${recommendedJDK}/` + `A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later` ) return } diff --git a/src/graalvm.ts b/src/graalvm.ts index ab904d2..4519028 100644 --- a/src/graalvm.ts +++ b/src/graalvm.ts @@ -9,7 +9,7 @@ import { import {downloadGraalVMEELegacy} from './gds' import {downloadTool} from '@actions/tool-cache' import {basename} from 'path' -import {gt} from 'semver' +import {gt as semverGt, valid as semverValid} from 'semver' const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm' const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download` @@ -70,7 +70,10 @@ export async function findLatestGraalVMJDKCEJavaVersion( const versionNumberStartIndex = `refs/tags/${GRAALVM_JDK_TAG_PREFIX}`.length for (const matchingRef of matchingRefs) { const currentVersion = matchingRef.ref.substring(versionNumberStartIndex) - if (gt(currentVersion, highestVersion)) { + if ( + semverValid(currentVersion) && + semverGt(currentVersion, highestVersion) + ) { highestVersion = currentVersion } } diff --git a/src/main.ts b/src/main.ts index b0f6936..d94c7f9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ import * as c from './constants' import * as core from '@actions/core' import * as graalvm from './graalvm' +import {gte as semverGte, valid as semverValid} from 'semver' import {isFeatureAvailable as isCacheAvailable} from '@actions/cache' import {join} from 'path' import {restore} from './features/cache' @@ -69,7 +70,10 @@ async function run(): Promise { } else { switch (graalvmVersion) { case c.VERSION_LATEST: - if (javaVersion.startsWith('17') || javaVersion.startsWith('20')) { + if ( + javaVersion.startsWith('17') || + (semverValid(javaVersion) && semverGte(javaVersion, '20')) + ) { core.info( `This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).` )