mirror of
https://github.com/actions/setup-java.git
synced 2025-06-28 20:14:14 +00:00
- Essentially use same concepts as jdk install to switch maven and gradle versions if those are defined with config. - Bump to tool-cache 1.3.0 as 1.0.0 tries to use node_modules/@actions/tool-cache/scripts/externals/unzip which doesn't have execute flag so you'd get `Permission denied` - `extractZipNix` in toolkit no longer support relative path so needs to resolve absolute path before passing file to these methods. - Commit has my local build for `index.js` which probably should get recreated but makes it easier to test this from a PR branch. - Fixes #40
48 lines
1.8 KiB
TypeScript
48 lines
1.8 KiB
TypeScript
import * as core from '@actions/core';
|
|
import * as installer from './installer';
|
|
import * as mavenInstaller from './maven-installer';
|
|
import * as gradleInstaller from './gradle-installer';
|
|
import * as auth from './auth';
|
|
import * as path from 'path';
|
|
|
|
async function run() {
|
|
try {
|
|
let version = core.getInput('version');
|
|
if (!version) {
|
|
version = core.getInput('java-version', {required: true});
|
|
}
|
|
const arch = core.getInput('architecture', {required: true});
|
|
const javaPackage = core.getInput('java-package', {required: true});
|
|
const jdkFile = core.getInput('jdkFile', {required: false}) || '';
|
|
|
|
await installer.getJava(version, arch, jdkFile, javaPackage);
|
|
|
|
const mavenVersion = core.getInput('maven-version', {required: false});
|
|
const mavenFile = core.getInput('maven-file', {required: false}) || '';
|
|
const mavenMirror = core.getInput('maven-mirror', {required: false});
|
|
if (mavenVersion) {
|
|
await mavenInstaller.getMaven(mavenVersion, mavenFile, mavenMirror);
|
|
}
|
|
|
|
const gradleVersion = core.getInput('gradle-version', {required: false});
|
|
const gradleFile = core.getInput('gradle-file', {required: false}) || '';
|
|
if (gradleVersion) {
|
|
await gradleInstaller.getGradle(gradleVersion, gradleFile);
|
|
}
|
|
|
|
const matchersPath = path.join(__dirname, '..', '.github');
|
|
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
|
|
|
const id = core.getInput('server-id', {required: false}) || undefined;
|
|
const username =
|
|
core.getInput('server-username', {required: false}) || undefined;
|
|
const password =
|
|
core.getInput('server-password', {required: false}) || undefined;
|
|
|
|
await auth.configAuthentication(id, username, password);
|
|
} catch (error) {
|
|
core.setFailed(error.message);
|
|
}
|
|
}
|
|
|
|
run();
|