Cache installations in GitHub tool-cache.

Fixes #7
This commit is contained in:
Fabio Niephaus
2022-03-01 10:50:00 +01:00
parent 61450f0977
commit 66dc2bf069
7 changed files with 78 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
import * as c from './constants'
import {downloadAndExtractJDK, getLatestRelease} from './utils'
import {downloadExtractAndCacheJDK, getLatestRelease} from './utils'
const MANDREL_REPO = 'mandrel'
const MANDREL_TAG_PREFIX = c.MANDREL_NAMESPACE
@@ -46,7 +46,8 @@ async function setUpMandrelRelease(
): Promise<string> {
const identifier = determineMandrelIdentifier(version, javaVersion)
const downloadUrl = `${MANDREL_DL_BASE}/${MANDREL_TAG_PREFIX}${version}/${identifier}${c.GRAALVM_FILE_EXTENSION}`
return downloadAndExtractJDK(downloadUrl)
const toolName = determineToolName(javaVersion)
return downloadExtractAndCacheJDK(downloadUrl, toolName, version)
}
function determineMandrelIdentifier(
@@ -55,3 +56,7 @@ function determineMandrelIdentifier(
): string {
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
}
function determineToolName(javaVersion: string): string {
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}`
}