Compare commits

..

1 Commits

Author SHA1 Message Date
Fabio Niephaus
a312beff36 Preserve file extension when downloading
Fixes #195
2025-11-21 18:28:05 +00:00
9 changed files with 23 additions and 66 deletions

View File

@@ -54,9 +54,6 @@ jobs:
]
set-gds-token: [false]
components: ['']
exclude:
- os: macos-13
java-version: 'dev'
include:
- java-version: 'latest-ea'
distribution: 'graalvm'

View File

@@ -76,7 +76,7 @@ test('find version/javaVersion', async () => {
}
error = err
}
expect(error.message).toContain('Could not find latest GraalVM release:')
expect(error.message).toContain('Could not find highest Java version.')
})
test('find EA version/javaVersion', async () => {

2
dist/cleanup.js generated vendored
View File

@@ -27288,7 +27288,7 @@ function requireCore () {
var coreExports = requireCore();
const ACTION_VERSION = '1.4.3';
const ACTION_VERSION = '1.4.2';
const INPUT_GITHUB_TOKEN = 'github-token';
const INPUT_CACHE = 'cache';
process.platform === 'linux';

17
dist/main.js generated vendored
View File

@@ -39,7 +39,7 @@ import * as https from 'node:https';
import * as zlib from 'node:zlib';
import require$$1$6 from 'tty';
const ACTION_VERSION = '1.4.3';
const ACTION_VERSION = '1.4.2';
const INPUT_VERSION = 'version';
const INPUT_GDS_TOKEN = 'gds-token';
const INPUT_JAVA_VERSION = 'java-version';
@@ -38705,11 +38705,6 @@ async function downloadExtractAndCacheJDK(downloader, toolName, version) {
}
return findJavaHomeInSubfolder(toolPath);
}
/**
* This copy of tc.downloadTool() preserves the file extension in the dest.
* The file extension is required on Windows runners without .NET to extract zip files correctly.
* See #195 and https://github.com/actions/toolkit/blob/6b63a2bfc339a753a113d2266323a4d52d84dee0/packages/tool-cache/src/tool-cache.ts#L44
*/
async function downloadFile(downloadUrl) {
const dest = join(_getTempDirectory(), crypto.randomUUID(), extname(downloadUrl));
return toolCacheExports.downloadTool(downloadUrl, dest);
@@ -40597,7 +40592,7 @@ function findHighestJavaVersion(release, version) {
return String(highestJavaVersion);
}
else {
return undefined;
throw new Error('Could not find highest Java version. Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.');
}
}
// Support for GraalVM 22.X releases and earlier
@@ -40630,9 +40625,7 @@ async function setUpGraalVMRelease(gdsToken, version, javaVersion) {
return downloadExtractAndCacheJDK(downloader, toolName, version);
}
function findDownloadUrl(release, javaVersion) {
const graalVMIdentifier = javaVersion
? determineGraalVMLegacyIdentifier(false, VERSION_DEV, javaVersion)
: determineGraalVMIdentifier(false, VERSION_DEV);
const graalVMIdentifier = determineGraalVMLegacyIdentifier(false, VERSION_DEV, javaVersion);
const expectedFileName = `${graalVMIdentifier}${GRAALVM_FILE_EXTENSION}`;
for (const asset of release.assets) {
if (asset.name === expectedFileName) {
@@ -40641,10 +40634,6 @@ function findDownloadUrl(release, javaVersion) {
}
throw new Error(`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. ${ERROR_HINT}`);
}
function determineGraalVMIdentifier(isEE, version) {
const infix = 'community' ;
return `graalvm-${infix}-${version}-${GRAALVM_PLATFORM}-${GRAALVM_ARCH}`;
}
function determineGraalVMLegacyIdentifier(isEE, version, javaVersion) {
return `${determineLegacyToolName(isEE, version, javaVersion)}-${GRAALVM_ARCH}-${version}`;
}

37
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "setup-graalvm",
"version": "1.4.3",
"version": "1.4.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-graalvm",
"version": "1.4.3",
"version": "1.4.2",
"license": "UPL",
"dependencies": {
"@actions/cache": "^4.1.0",
@@ -42,7 +42,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^30.2.0",
"js-yaml": "^4.1.1",
"js-yaml": "^4.1.0",
"prettier": "^3.6.2",
"prettier-eslint": "^16.4.2",
"rollup": "^4.52.5",
@@ -603,7 +603,6 @@
"integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.27.1",
@@ -1604,9 +1603,9 @@
}
},
"node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": {
"version": "3.14.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2239,7 +2238,6 @@
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz",
"integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.1.0",
@@ -2555,7 +2553,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -3219,7 +3216,6 @@
"integrity": "sha512-uWN8YqxXxqFMX2RqGOrumsKeti4LlmIMIyV0lgut4jx7KQBcBiW6vkDtIBvHnHIquwNfJhk8v2OtmO8zXWHfPA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -3308,7 +3304,6 @@
"integrity": "sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.46.2",
"@typescript-eslint/types": "8.46.2",
@@ -3808,7 +3803,6 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -4253,7 +4247,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001726",
"electron-to-chromium": "^1.5.173",
@@ -5002,7 +4995,6 @@
"integrity": "sha512-iy2GE3MHrYTL5lrCtMZ0X1KLEKKUjmK0kzwcnefhR66txcEmXZD2YWgR5GNdcEwkNx3a0siYkSvl0vIC+Svjmg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -5079,7 +5071,6 @@
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@@ -5243,7 +5234,6 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz",
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
"dev": true,
"peer": true,
"dependencies": {
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.9",
@@ -7000,7 +6990,6 @@
"integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jest/core": "30.2.0",
"@jest/types": "30.2.0",
@@ -8132,9 +8121,9 @@
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -8204,7 +8193,6 @@
"integrity": "sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"acorn": "^8.5.0",
"eslint-visitor-keys": "^3.0.0",
@@ -9098,7 +9086,6 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -9336,7 +9323,6 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -9769,7 +9755,6 @@
"integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "1.0.8"
},
@@ -10439,7 +10424,6 @@
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -10740,7 +10724,6 @@
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@@ -10950,7 +10933,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -11023,7 +11005,6 @@
"integrity": "sha512-VUyWiTNQD7itdiMuJy+EuLEErLj3uwX/EpHQF8EOf33Dq3Ju6VW1GXm+swk6+1h7a49uv9fKZ+dft9jU7esdLA==",
"dev": true,
"hasInstallScript": true,
"peer": true,
"dependencies": {
"napi-postinstall": "^0.2.4"
},

View File

@@ -2,7 +2,7 @@
"name": "setup-graalvm",
"author": "GraalVM Community",
"description": "GitHub Action for GraalVM",
"version": "1.4.3",
"version": "1.4.2",
"type": "module",
"private": true,
"repository": {
@@ -70,7 +70,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^30.2.0",
"js-yaml": "^4.1.1",
"js-yaml": "^4.1.0",
"prettier": "^3.6.2",
"prettier-eslint": "^16.4.2",
"rollup": "^4.52.5",

View File

@@ -1,6 +1,6 @@
import * as otypes from '@octokit/types'
export const ACTION_VERSION = '1.4.3'
export const ACTION_VERSION = '1.4.2'
export const INPUT_VERSION = 'version'
export const INPUT_GDS_TOKEN = 'gds-token'

View File

@@ -174,7 +174,7 @@ export async function setUpGraalVMJDKDevBuild(): Promise<string> {
return downloadAndExtractJDK(downloadUrl)
}
export function findHighestJavaVersion(release: c.LatestReleaseResponseData, version: string): string | undefined {
export function findHighestJavaVersion(release: c.LatestReleaseResponseData, version: string): string {
const graalVMIdentifierPattern = determineGraalVMLegacyIdentifier(false, version, '(\\d+)')
const expectedFileNameRegExp = new RegExp(
`^${graalVMIdentifierPattern}${c.GRAALVM_FILE_EXTENSION.replace(/\./g, '\\.')}$`
@@ -192,7 +192,9 @@ export function findHighestJavaVersion(release: c.LatestReleaseResponseData, ver
if (highestJavaVersion > 0) {
return String(highestJavaVersion)
} else {
return undefined
throw new Error(
'Could not find highest Java version. Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
)
}
}
@@ -232,10 +234,8 @@ export async function setUpGraalVMRelease(gdsToken: string, version: string, jav
return downloadExtractAndCacheJDK(downloader, toolName, version)
}
function findDownloadUrl(release: c.LatestReleaseResponseData, javaVersion?: string): string {
const graalVMIdentifier = javaVersion
? determineGraalVMLegacyIdentifier(false, c.VERSION_DEV, javaVersion)
: determineGraalVMIdentifier(false, c.VERSION_DEV)
function findDownloadUrl(release: c.LatestReleaseResponseData, javaVersion: string): string {
const graalVMIdentifier = determineGraalVMLegacyIdentifier(false, c.VERSION_DEV, javaVersion)
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
for (const asset of release.assets) {
if (asset.name === expectedFileName) {
@@ -247,11 +247,6 @@ function findDownloadUrl(release: c.LatestReleaseResponseData, javaVersion?: str
)
}
function determineGraalVMIdentifier(isEE: boolean, version: string): string {
const infix = isEE ? 'ee' : version === c.VERSION_DEV ? 'community' : 'ce'
return `graalvm-${infix}-${version}-${c.GRAALVM_PLATFORM}-${c.GRAALVM_ARCH}`
}
function determineGraalVMLegacyIdentifier(isEE: boolean, version: string, javaVersion: string): string {
return `${determineLegacyToolName(isEE, version, javaVersion)}-${c.GRAALVM_ARCH}-${version}`
}

View File

@@ -87,11 +87,6 @@ export async function downloadExtractAndCacheJDK(
return findJavaHomeInSubfolder(toolPath)
}
/**
* This copy of tc.downloadTool() preserves the file extension in the dest.
* The file extension is required on Windows runners without .NET to extract zip files correctly.
* See #195 and https://github.com/actions/toolkit/blob/6b63a2bfc339a753a113d2266323a4d52d84dee0/packages/tool-cache/src/tool-cache.ts#L44
*/
export async function downloadFile(downloadUrl: string): Promise<string> {
const dest = join(_getTempDirectory(), crypto.randomUUID(), extname(downloadUrl))
return tc.downloadTool(downloadUrl, dest)