mirror of
https://github.com/actions/setup-java.git
synced 2025-11-26 17:09:09 +08:00
Compare commits
1 Commits
ebc6c3dc86
...
e911e6070d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e911e6070d |
18
.github/workflows/e2e-cache.yml
vendored
18
.github/workflows/e2e-cache.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
needs: gradle-save
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
needs: maven-save
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -121,7 +121,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-22.04]
|
||||
os: [macos-13, windows-latest, ubuntu-22.04]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
@@ -133,7 +133,7 @@ jobs:
|
||||
java-version: '11'
|
||||
cache: sbt
|
||||
- name: Setup SBT
|
||||
if: matrix.os == 'macos-15-intel'
|
||||
if: matrix.os == 'macos-13'
|
||||
run: |
|
||||
echo ""Installing SBT...""
|
||||
brew install sbt
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
run: sbt update
|
||||
|
||||
- name: Check files to cache on macos-latest
|
||||
if: matrix.os == 'macos-15-intel'
|
||||
if: matrix.os == 'macos-13'
|
||||
run: |
|
||||
if [ ! -d ~/Library/Caches/Coursier ]; then
|
||||
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
|
||||
@@ -170,7 +170,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-22.04]
|
||||
os: [macos-13, windows-latest, ubuntu-22.04]
|
||||
needs: sbt-save
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -184,7 +184,7 @@ jobs:
|
||||
cache: sbt
|
||||
|
||||
- name: Confirm that ~/Library/Caches/Coursier directory has been made
|
||||
if: matrix.os == 'macos-15-intel'
|
||||
if: matrix.os == 'macos-13'
|
||||
run: |
|
||||
if [ ! -d ~/Library/Caches/Coursier ]; then
|
||||
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
|
||||
|
||||
19
.github/workflows/e2e-versions.yml
vendored
19
.github/workflows/e2e-versions.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
distribution: [
|
||||
'temurin',
|
||||
'adopt',
|
||||
@@ -39,19 +39,10 @@ jobs:
|
||||
- distribution: microsoft
|
||||
version: 8
|
||||
- distribution: dragonwell
|
||||
os: macos-15-intel
|
||||
os: macos-13
|
||||
include:
|
||||
- distribution: microsoft
|
||||
os: windows-latest
|
||||
version: 25
|
||||
- distribution: microsoft
|
||||
os: ubuntu-latest
|
||||
version: 25
|
||||
- distribution: microsoft
|
||||
os: macos-latest
|
||||
version: 25
|
||||
- distribution: oracle
|
||||
os: macos-15-intel
|
||||
os: macos-13
|
||||
version: 17
|
||||
- distribution: oracle
|
||||
os: windows-latest
|
||||
@@ -229,7 +220,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
version: ['17-ea', '15.0.0-ea.14']
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -295,7 +286,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
distribution:
|
||||
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
|
||||
java-package: ['jre']
|
||||
|
||||
@@ -1,47 +1,4 @@
|
||||
[
|
||||
{
|
||||
"version": "25.0.0",
|
||||
"stable": true,
|
||||
"release_url": "https://aka.ms/download-jdk",
|
||||
"files": [
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-windows-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
|
||||
"arch": "aarch64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
|
||||
"arch": "aarch64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
|
||||
"arch": "aarch64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "21.0.0",
|
||||
"stable": true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,11 +29,6 @@ describe('findPackageForDownload', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
'25.x',
|
||||
'25.0.0',
|
||||
'https://aka.ms/download-jdk/microsoft-jdk-25.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||
],
|
||||
[
|
||||
'21.x',
|
||||
'21.0.0',
|
||||
|
||||
4
dist/cleanup/index.js
vendored
4
dist/cleanup/index.js
vendored
@@ -94747,8 +94747,8 @@ function convertVersionToSemver(version) {
|
||||
}
|
||||
exports.convertVersionToSemver = convertVersionToSemver;
|
||||
function getGitHubHttpHeaders() {
|
||||
const resolvedToken = core.getInput('token') || process.env.GITHUB_TOKEN;
|
||||
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
|
||||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
const headers = {
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
|
||||
219
dist/setup/index.js
vendored
219
dist/setup/index.js
vendored
@@ -129856,7 +129856,6 @@ class JavaBase {
|
||||
this.checkLatest = installerOptions.checkLatest;
|
||||
}
|
||||
setupJava() {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let foundJava = this.findInToolcache();
|
||||
if (foundJava && !this.checkLatest) {
|
||||
@@ -129864,22 +129863,7 @@ class JavaBase {
|
||||
}
|
||||
else {
|
||||
core.info('Trying to resolve the latest version from remote');
|
||||
const MAX_RETRIES = 4;
|
||||
const RETRY_DELAY_MS = 2000;
|
||||
const retryableCodes = [
|
||||
'ETIMEDOUT',
|
||||
'ECONNRESET',
|
||||
'ENOTFOUND',
|
||||
'ECONNREFUSED'
|
||||
];
|
||||
let retries = MAX_RETRIES;
|
||||
while (retries > 0) {
|
||||
try {
|
||||
// Clear console timers before each attempt to prevent conflicts
|
||||
if (retries < MAX_RETRIES && core.isDebug()) {
|
||||
const consoleAny = console;
|
||||
(_b = (_a = consoleAny._times) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
|
||||
}
|
||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
|
||||
@@ -129890,23 +129874,8 @@ class JavaBase {
|
||||
foundJava = yield this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (error) {
|
||||
retries--;
|
||||
// Check if error is retryable (including aggregate errors)
|
||||
const isRetryable = (error instanceof tc.HTTPError &&
|
||||
error.httpStatusCode &&
|
||||
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
|
||||
retryableCodes.includes(error === null || error === void 0 ? void 0 : error.code) ||
|
||||
((error === null || error === void 0 ? void 0 : error.errors) &&
|
||||
Array.isArray(error.errors) &&
|
||||
error.errors.some((err) => retryableCodes.includes(err === null || err === void 0 ? void 0 : err.code)));
|
||||
if (retries > 0 && isRetryable) {
|
||||
core.debug(`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`);
|
||||
yield new Promise(r => setTimeout(r, RETRY_DELAY_MS));
|
||||
continue;
|
||||
}
|
||||
if (error instanceof tc.HTTPError) {
|
||||
if (error.httpStatusCode === 403) {
|
||||
core.error('HTTP 403: Permission denied or access restricted.');
|
||||
@@ -129918,52 +129887,16 @@ class JavaBase {
|
||||
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
else if (error && error.errors && Array.isArray(error.errors)) {
|
||||
core.error(`Java setup failed due to network or configuration error(s)`);
|
||||
else {
|
||||
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(`Java setup failed due to network issue or timeout: ${message}`);
|
||||
}
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
for (const err of error.errors) {
|
||||
const endpoint = (err === null || err === void 0 ? void 0 : err.address) || (err === null || err === void 0 ? void 0 : err.hostname) || '';
|
||||
const port = (err === null || err === void 0 ? void 0 : err.port) ? `:${err.port}` : '';
|
||||
const message = (err === null || err === void 0 ? void 0 : err.message) || 'Aggregate error';
|
||||
const endpointInfo = !message.includes(endpoint)
|
||||
? ` ${endpoint}${port}`
|
||||
: '';
|
||||
const localInfo = err.localAddress && err.localPort
|
||||
? ` - Local (${err.localAddress}:${err.localPort})`
|
||||
: '';
|
||||
const logMessage = `${message}${endpointInfo}${localInfo}`;
|
||||
core.error(logMessage);
|
||||
core.debug(`${err.stack || err.message}`);
|
||||
Object.entries(err).forEach(([key, value]) => {
|
||||
core.debug(`"${key}": ${JSON.stringify(value)}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(`Java setup process failed due to: ${message}`);
|
||||
if (typeof (error === null || error === void 0 ? void 0 : error.code) === 'string') {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
const errorDetails = Object.assign({ name: error.name, message: error.message }, Object.getOwnPropertyNames(error)
|
||||
.filter(prop => !['name', 'message', 'stack'].includes(prop))
|
||||
.reduce((acc, prop) => {
|
||||
acc[prop] = error[prop];
|
||||
return acc;
|
||||
}, {}));
|
||||
Object.entries(errorDetails).forEach(([key, value]) => {
|
||||
core.debug(`"${key}": ${JSON.stringify(value)}`);
|
||||
});
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundJava) {
|
||||
throw new Error('Failed to resolve Java version');
|
||||
}
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
||||
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
|
||||
@@ -130592,56 +130525,37 @@ const tc = __importStar(__nccwpck_require__(27784));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||
const path_1 = __importDefault(__nccwpck_require__(71017));
|
||||
const base_installer_1 = __nccwpck_require__(59741);
|
||||
const http_client_1 = __nccwpck_require__(96255);
|
||||
const util_1 = __nccwpck_require__(92629);
|
||||
const http_client_1 = __nccwpck_require__(96255);
|
||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||
const GRAALVM_MIN_VERSION = 17;
|
||||
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'];
|
||||
class GraalVMDistribution extends base_installer_1.JavaBase {
|
||||
constructor(installerOptions) {
|
||||
super('GraalVM', installerOptions);
|
||||
}
|
||||
downloadTool(javaRelease) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
|
||||
core.info(`Extracting Java archive...`);
|
||||
const extension = (0, util_1.getDownloadArchiveExtension)();
|
||||
if (IS_WINDOWS) {
|
||||
if (process.platform === 'win32') {
|
||||
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
|
||||
// Add validation for extracted path
|
||||
if (!fs_1.default.existsSync(extractedJavaPath)) {
|
||||
throw new Error(`Extraction failed: path ${extractedJavaPath} does not exist`);
|
||||
}
|
||||
const dirContents = fs_1.default.readdirSync(extractedJavaPath);
|
||||
if (dirContents.length === 0) {
|
||||
throw new Error('Extraction failed: no files found in extracted directory');
|
||||
}
|
||||
const archivePath = path_1.default.join(extractedJavaPath, dirContents[0]);
|
||||
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
||||
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||
const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
}
|
||||
catch (error) {
|
||||
core.error(`Failed to download and extract GraalVM: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
findPackageForDownload(range) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Add input validation
|
||||
if (!range || typeof range !== 'string') {
|
||||
throw new Error('Version range is required and must be a string');
|
||||
}
|
||||
const arch = this.distributionArchitecture();
|
||||
if (!SUPPORTED_ARCHITECTURES.includes(arch)) {
|
||||
throw new Error(`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`);
|
||||
if (arch !== 'x64' && arch !== 'aarch64') {
|
||||
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
||||
}
|
||||
if (!this.stable) {
|
||||
return this.findEABuildDownloadUrl(`${range}-ea`);
|
||||
@@ -130651,104 +130565,81 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
||||
}
|
||||
const platform = this.getPlatform();
|
||||
const extension = (0, util_1.getDownloadArchiveExtension)();
|
||||
const major = range.includes('.') ? range.split('.')[0] : range;
|
||||
const majorVersion = parseInt(major);
|
||||
if (isNaN(majorVersion)) {
|
||||
throw new Error(`Invalid version format: ${range}`);
|
||||
let major;
|
||||
let fileUrl;
|
||||
if (range.includes('.')) {
|
||||
major = range.split('.')[0];
|
||||
fileUrl = `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||
}
|
||||
if (majorVersion < GRAALVM_MIN_VERSION) {
|
||||
throw new Error(`GraalVM is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`);
|
||||
else {
|
||||
major = range;
|
||||
fileUrl = `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||
}
|
||||
if (parseInt(major) < 17) {
|
||||
throw new Error('GraalVM is only supported for JDK 17 and later');
|
||||
}
|
||||
const fileUrl = this.constructFileUrl(range, major, platform, arch, extension);
|
||||
const response = yield this.http.head(fileUrl);
|
||||
this.handleHttpResponse(response, range);
|
||||
if (response.message.statusCode === http_client_1.HttpCodes.NotFound) {
|
||||
throw new Error(`Could not find GraalVM for SemVer ${range}`);
|
||||
}
|
||||
if (response.message.statusCode !== http_client_1.HttpCodes.OK) {
|
||||
throw new Error(`Http request for GraalVM failed with status code: ${response.message.statusCode}`);
|
||||
}
|
||||
return { url: fileUrl, version: range };
|
||||
});
|
||||
}
|
||||
constructFileUrl(range, major, platform, arch, extension) {
|
||||
return range.includes('.')
|
||||
? `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`
|
||||
: `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||
}
|
||||
handleHttpResponse(response, range) {
|
||||
const statusCode = response.message.statusCode;
|
||||
if (statusCode === http_client_1.HttpCodes.NotFound) {
|
||||
throw new Error(`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`);
|
||||
}
|
||||
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
|
||||
statusCode === http_client_1.HttpCodes.Forbidden) {
|
||||
throw new Error(`Access denied when downloading GraalVM. Status code: ${statusCode}. Please check your credentials or permissions.`);
|
||||
}
|
||||
if (statusCode !== http_client_1.HttpCodes.OK) {
|
||||
throw new Error(`HTTP request for GraalVM failed with status code: ${statusCode} (${response.message.statusMessage || 'Unknown error'})`);
|
||||
}
|
||||
}
|
||||
findEABuildDownloadUrl(javaEaVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.debug(`Searching for EA build: ${javaEaVersion}`);
|
||||
const versions = yield this.fetchEAJson(javaEaVersion);
|
||||
core.debug(`Found ${versions.length} EA versions`);
|
||||
const latestVersion = versions.find(v => v.latest);
|
||||
if (!latestVersion) {
|
||||
core.error(`Available versions: ${versions.map(v => v.version).join(', ')}`);
|
||||
throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
|
||||
}
|
||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||
const arch = this.distributionArchitecture();
|
||||
const file = latestVersion.files.find(f => f.arch === arch && f.platform === GRAALVM_PLATFORM);
|
||||
if (!file) {
|
||||
core.error(`Available files for architecture ${arch}: ${JSON.stringify(latestVersion.files)}`);
|
||||
throw new Error(`Unable to find file for architecture '${arch}' and platform '${GRAALVM_PLATFORM}'`);
|
||||
if (!file || !file.filename.startsWith('graalvm-jdk-')) {
|
||||
throw new Error(`Unable to find file metadata for '${javaEaVersion}'`);
|
||||
}
|
||||
if (!file.filename.startsWith('graalvm-jdk-')) {
|
||||
throw new Error(`Invalid filename format: ${file.filename}. Expected to start with 'graalvm-jdk-'`);
|
||||
}
|
||||
const downloadUrl = `${latestVersion.download_base_url}${file.filename}`;
|
||||
core.debug(`Download URL: ${downloadUrl}`);
|
||||
return {
|
||||
url: downloadUrl,
|
||||
url: `${latestVersion.download_base_url}${file.filename}`,
|
||||
version: latestVersion.version
|
||||
};
|
||||
});
|
||||
}
|
||||
fetchEAJson(javaEaVersion) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/${javaEaVersion}.json?ref=main`;
|
||||
const owner = 'graalvm';
|
||||
const repository = 'oracle-graalvm-ea-builds';
|
||||
const branch = 'main';
|
||||
const filePath = `versions/${javaEaVersion}.json`;
|
||||
const url = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
|
||||
const headers = (0, util_1.getGitHubHttpHeaders)();
|
||||
core.debug(`Trying to fetch available version info for GraalVM EA builds from '${url}'`);
|
||||
let fetchedJson;
|
||||
try {
|
||||
const response = yield this.http.getJson(url, headers);
|
||||
if (!response.result) {
|
||||
throw new Error(`No GraalVM EA build found for version '${javaEaVersion}'. Please check if the version is correct.`);
|
||||
fetchedJson = (yield this.http.getJson(url, headers))
|
||||
.result;
|
||||
}
|
||||
return response.result;
|
||||
catch (err) {
|
||||
throw Error(`Fetching version info for GraalVM EA builds from '${url}' failed with the error: ${err.message}`);
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof Error) {
|
||||
// Check if it's a 404 error (file not found)
|
||||
if ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('404')) {
|
||||
throw new Error(`GraalVM EA version '${javaEaVersion}' not found. Please verify the version exists in the EA builds repository.`);
|
||||
}
|
||||
// Re-throw with more context
|
||||
throw new Error(`Failed to fetch GraalVM EA version information for '${javaEaVersion}': ${error.message}`);
|
||||
}
|
||||
// If it's not an Error instance, throw a generic error
|
||||
throw new Error(`Failed to fetch GraalVM EA version information for '${javaEaVersion}'`);
|
||||
if (fetchedJson === null) {
|
||||
throw Error(`No GraalVM EA build found. Are you sure java-version: '${javaEaVersion}' is correct?`);
|
||||
}
|
||||
return fetchedJson;
|
||||
});
|
||||
}
|
||||
getPlatform(platform = process.platform) {
|
||||
const platformMap = {
|
||||
darwin: 'macos',
|
||||
win32: 'windows',
|
||||
linux: 'linux'
|
||||
};
|
||||
const result = platformMap[platform];
|
||||
if (!result) {
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
default:
|
||||
throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.GraalVMDistribution = GraalVMDistribution;
|
||||
@@ -131629,9 +131520,9 @@ class SapMachineDistribution extends base_installer_1.JavaBase {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const platform = this.getPlatformOption();
|
||||
const arch = this.distributionArchitecture();
|
||||
let fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sapmachine.io/assets/data/sapmachine-releases-all.json');
|
||||
let fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json');
|
||||
if (!fetchedReleasesJson) {
|
||||
fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json');
|
||||
fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages', (0, util_1.getGitHubHttpHeaders)());
|
||||
}
|
||||
if (!fetchedReleasesJson) {
|
||||
throw new Error(`Couldn't fetch SapMachine versions information from both primary and backup urls`);
|
||||
@@ -132891,8 +132782,8 @@ function convertVersionToSemver(version) {
|
||||
}
|
||||
exports.convertVersionToSemver = convertVersionToSemver;
|
||||
function getGitHubHttpHeaders() {
|
||||
const resolvedToken = core.getInput('token') || process.env.GITHUB_TOKEN;
|
||||
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
|
||||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
const headers = {
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
|
||||
217
package-lock.json
generated
217
package-lock.json
generated
@@ -23,7 +23,7 @@
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^24.1.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
||||
"@typescript-eslint/parser": "^8.35.1",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
@@ -366,7 +366,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.3.tgz",
|
||||
"integrity": "sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.2.0",
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
@@ -841,9 +840,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz",
|
||||
"integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==",
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
|
||||
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
@@ -1716,17 +1715,17 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.0.tgz",
|
||||
"integrity": "sha512-XxXP5tL1txl13YFtrECECQYeZjBZad4fyd3cFV4a19LkAY/bIp9fev3US4S5fDVV2JaYFiKAZ/GRTOLer+mbyQ==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.46.2.tgz",
|
||||
"integrity": "sha512-ZGBMToy857/NIPaaCucIUQgqueOiq7HeAKkhlvqVV4lm089zUFW6ikRySx2v+cAhKeUCPuWVHeimyk6Dw1iY3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "8.48.0",
|
||||
"@typescript-eslint/type-utils": "8.48.0",
|
||||
"@typescript-eslint/utils": "8.48.0",
|
||||
"@typescript-eslint/visitor-keys": "8.48.0",
|
||||
"@typescript-eslint/scope-manager": "8.46.2",
|
||||
"@typescript-eslint/type-utils": "8.46.2",
|
||||
"@typescript-eslint/utils": "8.46.2",
|
||||
"@typescript-eslint/visitor-keys": "8.46.2",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^7.0.0",
|
||||
"natural-compare": "^1.4.0",
|
||||
@@ -1740,7 +1739,7 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/parser": "^8.48.0",
|
||||
"@typescript-eslint/parser": "^8.46.2",
|
||||
"eslint": "^8.57.0 || ^9.0.0",
|
||||
"typescript": ">=4.8.4 <6.0.0"
|
||||
}
|
||||
@@ -1750,22 +1749,22 @@
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
|
||||
"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.0.tgz",
|
||||
"integrity": "sha512-jCzKdm/QK0Kg4V4IK/oMlRZlY+QOcdjv89U2NgKHZk1CYTj82/RVSx1mV/0gqCVMJ/DA+Zf/S4NBWNF8GQ+eqQ==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.46.2.tgz",
|
||||
"integrity": "sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.48.0",
|
||||
"@typescript-eslint/types": "8.48.0",
|
||||
"@typescript-eslint/typescript-estree": "8.48.0",
|
||||
"@typescript-eslint/visitor-keys": "8.48.0",
|
||||
"@typescript-eslint/scope-manager": "8.46.2",
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
"@typescript-eslint/typescript-estree": "8.46.2",
|
||||
"@typescript-eslint/visitor-keys": "8.46.2",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1781,14 +1780,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/project-service": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.0.tgz",
|
||||
"integrity": "sha512-Ne4CTZyRh1BecBf84siv42wv5vQvVmgtk8AuiEffKTUo3DrBaGYZueJSxxBZ8fjk/N3DrgChH4TOdIOwOwiqqw==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.46.2.tgz",
|
||||
"integrity": "sha512-PULOLZ9iqwI7hXcmL4fVfIsBi6AN9YxRc0frbvmg8f+4hQAjQ5GYNKK0DIArNo+rOKmR/iBYwkpBmnIwin4wBg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/tsconfig-utils": "^8.48.0",
|
||||
"@typescript-eslint/types": "^8.48.0",
|
||||
"@typescript-eslint/tsconfig-utils": "^8.46.2",
|
||||
"@typescript-eslint/types": "^8.46.2",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1803,14 +1802,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.0.tgz",
|
||||
"integrity": "sha512-uGSSsbrtJrLduti0Q1Q9+BF1/iFKaxGoQwjWOIVNJv0o6omrdyR8ct37m4xIl5Zzpkp69Kkmvom7QFTtue89YQ==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.46.2.tgz",
|
||||
"integrity": "sha512-LF4b/NmGvdWEHD2H4MsHD8ny6JpiVNDzrSZr3CsckEgCbAGZbYM4Cqxvi9L+WqDMT+51Ozy7lt2M+d0JLEuBqA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.48.0",
|
||||
"@typescript-eslint/visitor-keys": "8.48.0"
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
"@typescript-eslint/visitor-keys": "8.46.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -1821,9 +1820,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/tsconfig-utils": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.0.tgz",
|
||||
"integrity": "sha512-WNebjBdFdyu10sR1M4OXTt2OkMd5KWIL+LLfeH9KhgP+jzfDV/LI3eXzwJ1s9+Yc0Kzo2fQCdY/OpdusCMmh6w==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.46.2.tgz",
|
||||
"integrity": "sha512-a7QH6fw4S57+F5y2FIxxSDyi5M4UfGF+Jl1bCGd7+L4KsaUY80GsiF/t0UoRFDHAguKlBaACWJRmdrc6Xfkkag==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1838,15 +1837,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.0.tgz",
|
||||
"integrity": "sha512-zbeVaVqeXhhab6QNEKfK96Xyc7UQuoFWERhEnj3mLVnUWrQnv15cJNseUni7f3g557gm0e46LZ6IJ4NJVOgOpw==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.46.2.tgz",
|
||||
"integrity": "sha512-HbPM4LbaAAt/DjxXaG9yiS9brOOz6fabal4uvUmaUYe6l3K1phQDMQKBRUrr06BQkxkvIZVVHttqiybM9nJsLA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.48.0",
|
||||
"@typescript-eslint/typescript-estree": "8.48.0",
|
||||
"@typescript-eslint/utils": "8.48.0",
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
"@typescript-eslint/typescript-estree": "8.46.2",
|
||||
"@typescript-eslint/utils": "8.46.2",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^2.1.0"
|
||||
},
|
||||
@@ -1863,9 +1862,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.0.tgz",
|
||||
"integrity": "sha512-cQMcGQQH7kwKoVswD1xdOytxQR60MWKM1di26xSUtxehaDs/32Zpqsu5WJlXTtTTqyAVK8R7hvsUnIXRS+bjvA==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.46.2.tgz",
|
||||
"integrity": "sha512-lNCWCbq7rpg7qDsQrd3D6NyWYu+gkTENkG5IKYhUIcxSb59SQC/hEQ+MrG4sTgBVghTonNWq42bA/d4yYumldQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1877,20 +1876,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.0.tgz",
|
||||
"integrity": "sha512-ljHab1CSO4rGrQIAyizUS6UGHHCiAYhbfcIZ1zVJr5nMryxlXMVWS3duFPSKvSUbFPwkXMFk1k0EMIjub4sRRQ==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.46.2.tgz",
|
||||
"integrity": "sha512-f7rW7LJ2b7Uh2EiQ+7sza6RDZnajbNbemn54Ob6fRwQbgcIn+GWfyuHDHRYgRoZu1P4AayVScrRW+YfbTvPQoQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/project-service": "8.48.0",
|
||||
"@typescript-eslint/tsconfig-utils": "8.48.0",
|
||||
"@typescript-eslint/types": "8.48.0",
|
||||
"@typescript-eslint/visitor-keys": "8.48.0",
|
||||
"@typescript-eslint/project-service": "8.46.2",
|
||||
"@typescript-eslint/tsconfig-utils": "8.46.2",
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
"@typescript-eslint/visitor-keys": "8.46.2",
|
||||
"debug": "^4.3.4",
|
||||
"fast-glob": "^3.3.2",
|
||||
"is-glob": "^4.0.3",
|
||||
"minimatch": "^9.0.4",
|
||||
"semver": "^7.6.0",
|
||||
"tinyglobby": "^0.2.15",
|
||||
"ts-api-utils": "^2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1931,16 +1931,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.0.tgz",
|
||||
"integrity": "sha512-yTJO1XuGxCsSfIVt1+1UrLHtue8xz16V8apzPYI06W0HbEbEWHxHXgZaAgavIkoh+GeV6hKKd5jm0sS6OYxWXQ==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.46.2.tgz",
|
||||
"integrity": "sha512-sExxzucx0Tud5tE0XqR0lT0psBQvEpnpiul9XbGUB1QwpWJJAps1O/Z7hJxLGiZLBKMCutjTzDgmd1muEhBnVg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.7.0",
|
||||
"@typescript-eslint/scope-manager": "8.48.0",
|
||||
"@typescript-eslint/types": "8.48.0",
|
||||
"@typescript-eslint/typescript-estree": "8.48.0"
|
||||
"@typescript-eslint/scope-manager": "8.46.2",
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
"@typescript-eslint/typescript-estree": "8.46.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -1955,13 +1955,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.0.tgz",
|
||||
"integrity": "sha512-T0XJMaRPOH3+LBbAfzR2jalckP1MSG/L9eUtY0DEzUyVaXJ/t6zN0nR7co5kz0Jko/nkSYCBRkz1djvjajVTTg==",
|
||||
"version": "8.46.2",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.46.2.tgz",
|
||||
"integrity": "sha512-tUFMXI4gxzzMXt4xpGJEsBsTox0XbNQ1y94EwlD/CuZwFcQP79xfQqMhau9HsRc/J0cAPA/HZt1dZPtGn9V/7w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.48.0",
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
"eslint-visitor-keys": "^4.2.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -2016,7 +2016,6 @@
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -2292,7 +2291,6 @@
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001541",
|
||||
"electron-to-chromium": "^1.4.535",
|
||||
@@ -2748,7 +2746,6 @@
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz",
|
||||
"integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
@@ -3095,6 +3092,36 @@
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fast-glob": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
|
||||
"integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
"@nodelib/fs.walk": "^1.2.3",
|
||||
"glob-parent": "^5.1.2",
|
||||
"merge2": "^1.3.0",
|
||||
"micromatch": "^4.0.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-glob/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
@@ -3717,7 +3744,6 @@
|
||||
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
|
||||
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jest/core": "^29.7.0",
|
||||
"@jest/types": "^29.6.3",
|
||||
@@ -4461,6 +4487,16 @@
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/merge2": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/micromatch": {
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||
@@ -5315,55 +5351,6 @@
|
||||
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.15",
|
||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
||||
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fdir": "^6.5.0",
|
||||
"picomatch": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby/node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"picomatch": "^3 || ^4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"picomatch": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby/node_modules/picomatch": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/tmpl": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
||||
@@ -5508,7 +5495,6 @@
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -5521,6 +5507,7 @@
|
||||
"version": "5.29.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
||||
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^24.1.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
||||
"@typescript-eslint/parser": "^8.35.1",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
|
||||
@@ -51,22 +51,7 @@ export abstract class JavaBase {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
} else {
|
||||
core.info('Trying to resolve the latest version from remote');
|
||||
const MAX_RETRIES = 4;
|
||||
const RETRY_DELAY_MS = 2000;
|
||||
const retryableCodes = [
|
||||
'ETIMEDOUT',
|
||||
'ECONNRESET',
|
||||
'ENOTFOUND',
|
||||
'ECONNREFUSED'
|
||||
];
|
||||
let retries = MAX_RETRIES;
|
||||
while (retries > 0) {
|
||||
try {
|
||||
// Clear console timers before each attempt to prevent conflicts
|
||||
if (retries < MAX_RETRIES && core.isDebug()) {
|
||||
const consoleAny = console as any;
|
||||
consoleAny._times?.clear?.();
|
||||
}
|
||||
const javaRelease = await this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if (foundJava?.version === javaRelease.version) {
|
||||
@@ -76,90 +61,29 @@ export abstract class JavaBase {
|
||||
foundJava = await this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
}
|
||||
break;
|
||||
} catch (error: any) {
|
||||
retries--;
|
||||
// Check if error is retryable (including aggregate errors)
|
||||
const isRetryable =
|
||||
(error instanceof tc.HTTPError &&
|
||||
error.httpStatusCode &&
|
||||
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
|
||||
retryableCodes.includes(error?.code) ||
|
||||
(error?.errors &&
|
||||
Array.isArray(error.errors) &&
|
||||
error.errors.some((err: any) =>
|
||||
retryableCodes.includes(err?.code)
|
||||
));
|
||||
if (retries > 0 && isRetryable) {
|
||||
core.debug(
|
||||
`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`
|
||||
);
|
||||
await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
|
||||
continue;
|
||||
}
|
||||
if (error instanceof tc.HTTPError) {
|
||||
if (error.httpStatusCode === 403) {
|
||||
core.error('HTTP 403: Permission denied or access restricted.');
|
||||
} else if (error.httpStatusCode === 429) {
|
||||
core.warning(
|
||||
'HTTP 429: Rate limit exceeded. Please retry later.'
|
||||
);
|
||||
core.warning('HTTP 429: Rate limit exceeded. Please retry later.');
|
||||
} else {
|
||||
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
|
||||
}
|
||||
} else if (error && error.errors && Array.isArray(error.errors)) {
|
||||
core.error(
|
||||
`Java setup failed due to network or configuration error(s)`
|
||||
);
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
for (const err of error.errors) {
|
||||
const endpoint = err?.address || err?.hostname || '';
|
||||
const port = err?.port ? `:${err.port}` : '';
|
||||
const message = err?.message || 'Aggregate error';
|
||||
const endpointInfo = !message.includes(endpoint)
|
||||
? ` ${endpoint}${port}`
|
||||
: '';
|
||||
const localInfo =
|
||||
err.localAddress && err.localPort
|
||||
? ` - Local (${err.localAddress}:${err.localPort})`
|
||||
: '';
|
||||
const logMessage = `${message}${endpointInfo}${localInfo}`;
|
||||
core.error(logMessage);
|
||||
core.debug(`${err.stack || err.message}`);
|
||||
Object.entries(err).forEach(([key, value]) => {
|
||||
core.debug(`"${key}": ${JSON.stringify(value)}`);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const message =
|
||||
error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(`Java setup process failed due to: ${message}`);
|
||||
if (typeof error?.code === 'string') {
|
||||
core.debug(error.stack);
|
||||
core.error(
|
||||
`Java setup failed due to network issue or timeout: ${message}`
|
||||
);
|
||||
}
|
||||
const errorDetails = {
|
||||
name: error.name,
|
||||
message: error.message,
|
||||
...Object.getOwnPropertyNames(error)
|
||||
.filter(prop => !['name', 'message', 'stack'].includes(prop))
|
||||
.reduce<{[key: string]: any}>((acc, prop) => {
|
||||
acc[prop] = error[prop];
|
||||
return acc;
|
||||
}, {})
|
||||
};
|
||||
Object.entries(errorDetails).forEach(([key, value]) => {
|
||||
core.debug(`"${key}": ${JSON.stringify(value)}`);
|
||||
});
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundJava) {
|
||||
throw new Error('Failed to resolve Java version');
|
||||
}
|
||||
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
const macOSPostfixPath = path.join(
|
||||
foundJava.path,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import {JavaBase} from '../base-installer';
|
||||
import {HttpCodes} from '@actions/http-client';
|
||||
import {GraalVMEAVersion} from './models';
|
||||
import {
|
||||
JavaDownloadRelease,
|
||||
JavaInstallerOptions,
|
||||
@@ -16,14 +16,12 @@ import {
|
||||
getGitHubHttpHeaders,
|
||||
renameWinArchive
|
||||
} from '../../util';
|
||||
import {HttpCodes} from '@actions/http-client';
|
||||
import {GraalVMEAVersion} from './models';
|
||||
|
||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||
const GRAALVM_MIN_VERSION = 17;
|
||||
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'] as const;
|
||||
type SupportedArchitecture = (typeof SUPPORTED_ARCHITECTURES)[number];
|
||||
type OsVersions = 'linux' | 'macos' | 'windows';
|
||||
|
||||
export class GraalVMDistribution extends JavaBase {
|
||||
constructor(installerOptions: JavaInstallerOptions) {
|
||||
@@ -33,7 +31,6 @@ export class GraalVMDistribution extends JavaBase {
|
||||
protected async downloadTool(
|
||||
javaRelease: JavaDownloadRelease
|
||||
): Promise<JavaInstallerResults> {
|
||||
try {
|
||||
core.info(
|
||||
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
|
||||
);
|
||||
@@ -41,30 +38,13 @@ export class GraalVMDistribution extends JavaBase {
|
||||
|
||||
core.info(`Extracting Java archive...`);
|
||||
const extension = getDownloadArchiveExtension();
|
||||
if (IS_WINDOWS) {
|
||||
if (process.platform === 'win32') {
|
||||
javaArchivePath = renameWinArchive(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
|
||||
|
||||
const extractedJavaPath = await extractJdkFile(
|
||||
javaArchivePath,
|
||||
extension
|
||||
);
|
||||
|
||||
// Add validation for extracted path
|
||||
if (!fs.existsSync(extractedJavaPath)) {
|
||||
throw new Error(
|
||||
`Extraction failed: path ${extractedJavaPath} does not exist`
|
||||
);
|
||||
}
|
||||
|
||||
const dirContents = fs.readdirSync(extractedJavaPath);
|
||||
if (dirContents.length === 0) {
|
||||
throw new Error(
|
||||
'Extraction failed: no files found in extracted directory'
|
||||
);
|
||||
}
|
||||
|
||||
const archivePath = path.join(extractedJavaPath, dirContents[0]);
|
||||
const archiveName = fs.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path.join(extractedJavaPath, archiveName);
|
||||
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||
|
||||
const javaPath = await tc.cacheDir(
|
||||
@@ -75,25 +55,14 @@ export class GraalVMDistribution extends JavaBase {
|
||||
);
|
||||
|
||||
return {version: javaRelease.version, path: javaPath};
|
||||
} catch (error) {
|
||||
core.error(`Failed to download and extract GraalVM: ${error}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
protected async findPackageForDownload(
|
||||
range: string
|
||||
): Promise<JavaDownloadRelease> {
|
||||
// Add input validation
|
||||
if (!range || typeof range !== 'string') {
|
||||
throw new Error('Version range is required and must be a string');
|
||||
}
|
||||
|
||||
const arch = this.distributionArchitecture();
|
||||
if (!SUPPORTED_ARCHITECTURES.includes(arch as SupportedArchitecture)) {
|
||||
throw new Error(
|
||||
`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`
|
||||
);
|
||||
if (arch !== 'x64' && arch !== 'aarch64') {
|
||||
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
||||
}
|
||||
|
||||
if (!this.stable) {
|
||||
@@ -106,113 +75,52 @@ export class GraalVMDistribution extends JavaBase {
|
||||
|
||||
const platform = this.getPlatform();
|
||||
const extension = getDownloadArchiveExtension();
|
||||
const major = range.includes('.') ? range.split('.')[0] : range;
|
||||
const majorVersion = parseInt(major);
|
||||
|
||||
if (isNaN(majorVersion)) {
|
||||
throw new Error(`Invalid version format: ${range}`);
|
||||
let major;
|
||||
let fileUrl;
|
||||
if (range.includes('.')) {
|
||||
major = range.split('.')[0];
|
||||
fileUrl = `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||
} else {
|
||||
major = range;
|
||||
fileUrl = `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||
}
|
||||
|
||||
if (majorVersion < GRAALVM_MIN_VERSION) {
|
||||
throw new Error(
|
||||
`GraalVM is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`
|
||||
);
|
||||
if (parseInt(major) < 17) {
|
||||
throw new Error('GraalVM is only supported for JDK 17 and later');
|
||||
}
|
||||
|
||||
const fileUrl = this.constructFileUrl(
|
||||
range,
|
||||
major,
|
||||
platform,
|
||||
arch,
|
||||
extension
|
||||
);
|
||||
|
||||
const response = await this.http.head(fileUrl);
|
||||
this.handleHttpResponse(response, range);
|
||||
|
||||
if (response.message.statusCode === HttpCodes.NotFound) {
|
||||
throw new Error(`Could not find GraalVM for SemVer ${range}`);
|
||||
}
|
||||
|
||||
if (response.message.statusCode !== HttpCodes.OK) {
|
||||
throw new Error(
|
||||
`Http request for GraalVM failed with status code: ${response.message.statusCode}`
|
||||
);
|
||||
}
|
||||
|
||||
return {url: fileUrl, version: range};
|
||||
}
|
||||
|
||||
private constructFileUrl(
|
||||
range: string,
|
||||
major: string,
|
||||
platform: string,
|
||||
arch: string,
|
||||
extension: string
|
||||
): string {
|
||||
return range.includes('.')
|
||||
? `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`
|
||||
: `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||
}
|
||||
|
||||
private handleHttpResponse(response: any, range: string): void {
|
||||
const statusCode = response.message.statusCode;
|
||||
|
||||
if (statusCode === HttpCodes.NotFound) {
|
||||
throw new Error(
|
||||
`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
statusCode === HttpCodes.Unauthorized ||
|
||||
statusCode === HttpCodes.Forbidden
|
||||
) {
|
||||
throw new Error(
|
||||
`Access denied when downloading GraalVM. Status code: ${statusCode}. Please check your credentials or permissions.`
|
||||
);
|
||||
}
|
||||
|
||||
if (statusCode !== HttpCodes.OK) {
|
||||
throw new Error(
|
||||
`HTTP request for GraalVM failed with status code: ${statusCode} (${response.message.statusMessage || 'Unknown error'})`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private async findEABuildDownloadUrl(
|
||||
javaEaVersion: string
|
||||
): Promise<JavaDownloadRelease> {
|
||||
core.debug(`Searching for EA build: ${javaEaVersion}`);
|
||||
|
||||
const versions = await this.fetchEAJson(javaEaVersion);
|
||||
core.debug(`Found ${versions.length} EA versions`);
|
||||
|
||||
const latestVersion = versions.find(v => v.latest);
|
||||
if (!latestVersion) {
|
||||
core.error(
|
||||
`Available versions: ${versions.map(v => v.version).join(', ')}`
|
||||
);
|
||||
throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
|
||||
}
|
||||
|
||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||
|
||||
const arch = this.distributionArchitecture();
|
||||
const file = latestVersion.files.find(
|
||||
f => f.arch === arch && f.platform === GRAALVM_PLATFORM
|
||||
);
|
||||
|
||||
if (!file) {
|
||||
core.error(
|
||||
`Available files for architecture ${arch}: ${JSON.stringify(latestVersion.files)}`
|
||||
);
|
||||
throw new Error(
|
||||
`Unable to find file for architecture '${arch}' and platform '${GRAALVM_PLATFORM}'`
|
||||
);
|
||||
if (!file || !file.filename.startsWith('graalvm-jdk-')) {
|
||||
throw new Error(`Unable to find file metadata for '${javaEaVersion}'`);
|
||||
}
|
||||
|
||||
if (!file.filename.startsWith('graalvm-jdk-')) {
|
||||
throw new Error(
|
||||
`Invalid filename format: ${file.filename}. Expected to start with 'graalvm-jdk-'`
|
||||
);
|
||||
}
|
||||
|
||||
const downloadUrl = `${latestVersion.download_base_url}${file.filename}`;
|
||||
core.debug(`Download URL: ${downloadUrl}`);
|
||||
|
||||
return {
|
||||
url: downloadUrl,
|
||||
url: `${latestVersion.download_base_url}${file.filename}`,
|
||||
version: latestVersion.version
|
||||
};
|
||||
}
|
||||
@@ -220,59 +128,49 @@ export class GraalVMDistribution extends JavaBase {
|
||||
private async fetchEAJson(
|
||||
javaEaVersion: string
|
||||
): Promise<GraalVMEAVersion[]> {
|
||||
const url = `https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/${javaEaVersion}.json?ref=main`;
|
||||
const owner = 'graalvm';
|
||||
const repository = 'oracle-graalvm-ea-builds';
|
||||
const branch = 'main';
|
||||
const filePath = `versions/${javaEaVersion}.json`;
|
||||
|
||||
const url = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
|
||||
|
||||
const headers = getGitHubHttpHeaders();
|
||||
|
||||
core.debug(
|
||||
`Trying to fetch available version info for GraalVM EA builds from '${url}'`
|
||||
);
|
||||
|
||||
let fetchedJson;
|
||||
try {
|
||||
const response = await this.http.getJson<GraalVMEAVersion[]>(
|
||||
url,
|
||||
headers
|
||||
);
|
||||
|
||||
if (!response.result) {
|
||||
throw new Error(
|
||||
`No GraalVM EA build found for version '${javaEaVersion}'. Please check if the version is correct.`
|
||||
fetchedJson = (await this.http.getJson<GraalVMEAVersion[]>(url, headers))
|
||||
.result;
|
||||
} catch (err) {
|
||||
throw Error(
|
||||
`Fetching version info for GraalVM EA builds from '${url}' failed with the error: ${
|
||||
(err as Error).message
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
return response.result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
// Check if it's a 404 error (file not found)
|
||||
if (error.message?.includes('404')) {
|
||||
throw new Error(
|
||||
`GraalVM EA version '${javaEaVersion}' not found. Please verify the version exists in the EA builds repository.`
|
||||
);
|
||||
}
|
||||
// Re-throw with more context
|
||||
throw new Error(
|
||||
`Failed to fetch GraalVM EA version information for '${javaEaVersion}': ${error.message}`
|
||||
);
|
||||
}
|
||||
// If it's not an Error instance, throw a generic error
|
||||
throw new Error(
|
||||
`Failed to fetch GraalVM EA version information for '${javaEaVersion}'`
|
||||
if (fetchedJson === null) {
|
||||
throw Error(
|
||||
`No GraalVM EA build found. Are you sure java-version: '${javaEaVersion}' is correct?`
|
||||
);
|
||||
}
|
||||
return fetchedJson;
|
||||
}
|
||||
|
||||
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
||||
const platformMap: Record<string, OsVersions> = {
|
||||
darwin: 'macos',
|
||||
win32: 'windows',
|
||||
linux: 'linux'
|
||||
};
|
||||
|
||||
const result = platformMap[platform];
|
||||
if (!result) {
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
default:
|
||||
throw new Error(
|
||||
`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,4 @@
|
||||
[
|
||||
{
|
||||
"version": "25.0.0",
|
||||
"stable": true,
|
||||
"release_url": "https://aka.ms/download-jdk",
|
||||
"files": [
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-windows-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
|
||||
"arch": "aarch64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
|
||||
"arch": "aarch64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
|
||||
"arch": "aarch64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "21.0.2",
|
||||
"stable": true,
|
||||
@@ -84,7 +41,7 @@
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-aarch64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
"version": "21.0.1",
|
||||
"stable": true,
|
||||
@@ -127,7 +84,7 @@
|
||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-aarch64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
"version": "21.0.0",
|
||||
"stable": true,
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
convertVersionToSemver,
|
||||
extractJdkFile,
|
||||
getDownloadArchiveExtension,
|
||||
getGitHubHttpHeaders,
|
||||
isVersionSatisfies,
|
||||
renameWinArchive
|
||||
} from '../../util';
|
||||
@@ -63,12 +64,13 @@ export class SapMachineDistribution extends JavaBase {
|
||||
const arch = this.distributionArchitecture();
|
||||
|
||||
let fetchedReleasesJson = await this.fetchReleasesFromUrl(
|
||||
'https://sapmachine.io/assets/data/sapmachine-releases-all.json'
|
||||
'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'
|
||||
);
|
||||
|
||||
if (!fetchedReleasesJson) {
|
||||
fetchedReleasesJson = await this.fetchReleasesFromUrl(
|
||||
'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'
|
||||
'https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages',
|
||||
getGitHubHttpHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ export function convertVersionToSemver(version: number[] | string) {
|
||||
}
|
||||
|
||||
export function getGitHubHttpHeaders(): OutgoingHttpHeaders {
|
||||
const resolvedToken = core.getInput('token') || process.env.GITHUB_TOKEN;
|
||||
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
|
||||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
|
||||
const headers: OutgoingHttpHeaders = {
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
|
||||
Reference in New Issue
Block a user