Fix Windows archives extraction issue (#689)

This commit is contained in:
Priya Gupta 2024-10-11 03:02:25 +05:30 committed by GitHub
parent 292cc14be8
commit 83a06ff9d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 154 additions and 104 deletions

View file

@ -13,7 +13,8 @@ import {
import {
extractJdkFile,
getDownloadArchiveExtension,
getGitHubHttpHeaders
getGitHubHttpHeaders,
renameWinArchive
} from '../../util';
import {HttpCodes} from '@actions/http-client';
import {GraalVMEAVersion} from './models';
@ -33,11 +34,13 @@ export class GraalVMDistribution extends JavaBase {
core.info(
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
);
const javaArchivePath = await tc.downloadTool(javaRelease.url);
let javaArchivePath = await tc.downloadTool(javaRelease.url);
core.info(`Extracting Java archive...`);
const extension = getDownloadArchiveExtension();
if (process.platform === 'win32') {
javaArchivePath = renameWinArchive(javaArchivePath);
}
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
const archiveName = fs.readdirSync(extractedJavaPath)[0];