Incorporate reviewer feedback.

This commit is contained in:
Fabio Niephaus 2023-06-16 10:31:54 +02:00 committed by Fabio Niephaus
parent c871f91ee0
commit 830cd48f7f
4 changed files with 17 additions and 7 deletions

9
dist/main/index.js generated vendored
View File

@ -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);
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -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<void> {
} 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).`
)