From 1dc95d11b7f3b596aec153d64ad82dfc8337d5a7 Mon Sep 17 00:00:00 2001 From: jmjaffe37 Date: Tue, 30 Jun 2026 16:53:58 -0700 Subject: [PATCH] Added pre-push changes --- dist/setup/index.js | 47 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 54ced2b5..f088d583 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -79932,6 +79932,7 @@ const core = __importStar(__nccwpck_require__(37484)); const tc = __importStar(__nccwpck_require__(33472)); const fs_1 = __importDefault(__nccwpck_require__(79896)); const path_1 = __importDefault(__nccwpck_require__(16928)); +const semver_1 = __importDefault(__nccwpck_require__(62088)); var microsoft_key_2 = __nccwpck_require__(56286); Object.defineProperty(exports, "MICROSOFT_PUBLIC_KEY", ({ enumerable: true, get: function () { return microsoft_key_2.MICROSOFT_PUBLIC_KEY; } })); class MicrosoftDistributions extends base_installer_1.JavaBase { @@ -79984,7 +79985,21 @@ class MicrosoftDistributions extends base_installer_1.JavaBase { if (!manifest) { throw new Error('Could not load manifest for Microsoft Build of OpenJDK'); } - const foundRelease = yield tc.findFromManifest(range, true, manifest, arch); + let foundRelease; + if (this.isRunningOnAlpine() && this.isAlpineSupportedVersion(range)) { + foundRelease = this.findFromManifestForPlatform(range, manifest, arch, 'alpine'); + if (foundRelease) { + core.debug(`Resolved Alpine package for Microsoft OpenJDK ${range}`); + } + } + else if (this.isRunningOnAlpine()) { + core.debug(`No Alpine package found for Microsoft OpenJDK ${range}, defaulting to standard linux package`); + } + // Runs if user is not running on alpine, or if no Alpine package was found + if (!foundRelease) { + foundRelease = yield tc.findFromManifest(range, true, manifest, arch); + } + // Runs if failed to find any matching package if (!foundRelease) { const availableVersionStrings = manifest.map(item => item.version); throw this.createVersionNotFoundError(range, availableVersionStrings); @@ -79998,17 +80013,37 @@ class MicrosoftDistributions extends base_installer_1.JavaBase { }; }); } + findFromManifestForPlatform(range, manifest, arch, platform) { + const matched = manifest + .filter(release => release.stable) + .filter(release => (0, util_1.isVersionSatisfies)(range, release.version)) + .map(release => { + const matchedFile = release.files.find((file) => file.arch === arch && file.platform === platform); + if (!matchedFile) { + return null; + } + return Object.assign(Object.assign({}, release), { files: [matchedFile] }); + }) + .filter((release) => release !== null) + .sort((a, b) => -semver_1.default.compareBuild(a.version, b.version)); + return matched[0]; + } + isAlpineSupportedVersion(range) { + const minVersion = semver_1.default.minVersion(range); + return !!minVersion && (minVersion.major === 11 || minVersion.major === 17); + } + isRunningOnAlpine() { + return process.platform === 'linux' && fs_1.default.existsSync('/etc/alpine-release'); + } supportsSignatureVerification() { return true; } getAvailableVersions() { return __awaiter(this, void 0, void 0, function* () { - // TODO get these dynamically! - // We will need Microsoft to add an endpoint where we can query for versions. - const owner = 'actions'; - const repository = 'setup-java'; + const owner = 'microsoft'; + const repository = 'openjdk-adoptium-marketplace-data'; const branch = 'main'; - const filePath = 'src/distributions/microsoft/microsoft-openjdk-versions.json'; + const filePath = 'general_info/microsoft-openjdk-versions.json'; let releases = null; const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; const headers = (0, util_1.getGitHubHttpHeaders)();