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

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).`
)