diff --git a/dist/index.js b/dist/index.js index 96632653..d81245c0 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/installer.ts b/src/installer.ts index cce8fa3d..5a2c0ae9 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -60,7 +60,7 @@ export async function getJava( const contents = await response.readBody(); const refs = contents.match(//gi) || []; - const downloadInfo = getDownloadInfo(refs, version, javaPackage); + const downloadInfo = getDownloadInfo(refs, version, arch, javaPackage); jdkFile = await tc.downloadTool(downloadInfo.url); version = downloadInfo.version; compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz'; @@ -188,20 +188,33 @@ async function unzipJavaDownload( function getDownloadInfo( refs: string[], version: string, + arch: string, javaPackage: string ): {version: string; url: string} { version = normalizeVersion(version); + + let archExtension = ''; + if (arch === 'x86') { + archExtension = 'i686'; + } else if (arch === 'x64') { + archExtension = 'x64'; + } else { + throw new Error(`architecture "${arch}" is not int [x86 | x64]`); + } + let extension = ''; if (IS_WINDOWS) { - extension = `-win_x64.zip`; + extension = `-win_${archExtension}.zip`; } else { if (process.platform === 'darwin') { - extension = `-macosx_x64.tar.gz`; + extension = `-macosx_${archExtension}.tar.gz`; } else { - extension = `-linux_x64.tar.gz`; + extension = `-linux_${archExtension}.tar.gz`; } } + core.debug(`Searching for files with extension: ${extension}`); + let pkgRegexp = new RegExp(''); let pkgTypeLength = 0; if (javaPackage === 'jdk') {