Skip to content

Commit

Permalink
Use stable release for dev builds on JDK 20 and earlier.
Browse files Browse the repository at this point in the history
See #36
  • Loading branch information
fniephaus committed Sep 6, 2023
1 parent 265e018 commit 570f6b2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +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 * as semver from 'semver'
import {isFeatureAvailable as isCacheAvailable} from '@actions/cache'
import {join} from 'path'
import {restore} from './features/cache'
Expand Down Expand Up @@ -80,7 +80,7 @@ async function run(): Promise<void> {
case c.VERSION_LATEST:
if (
javaVersion.startsWith('17') ||
(semverValid(javaVersion) && semverGte(javaVersion, '20'))
(semver.valid(javaVersion) && semver.gte(javaVersion, '20.0.0'))
) {
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).`
Expand All @@ -99,7 +99,18 @@ async function run(): Promise<void> {
'Downloading GraalVM EE dev builds is not supported'
)
}
graalVMHome = await graalvm.setUpGraalVMJDKDevBuild()
const coercedJavaVersion = semver.coerce(javaVersion)
if (
coercedJavaVersion !== null &&
!semver.gte(coercedJavaVersion, '21.0.0')
) {
core.warning(
`GraalVM dev builds are only available for JDK 21. This build is now using a stable release of GraalVM for JDK ${javaVersion}.`
)
graalVMHome = await graalvm.setUpGraalVMJDK(javaVersion)
} else {
graalVMHome = await graalvm.setUpGraalVMJDKDevBuild()
}
break
default:
if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
Expand Down

0 comments on commit 570f6b2

Please sign in to comment.