mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
add java-version-file input
This commit is contained in:
parent
098617936c
commit
5e09f33af6
2 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
export const MACOS_JAVA_CONTENT_POSTFIX = 'Contents/Home';
|
export const MACOS_JAVA_CONTENT_POSTFIX = 'Contents/Home';
|
||||||
export const INPUT_JAVA_VERSION = 'java-version';
|
export const INPUT_JAVA_VERSION = 'java-version';
|
||||||
|
export const INPUT_JAVA_VERSION_FILE = 'java-version-file';
|
||||||
export const INPUT_ARCHITECTURE = 'architecture';
|
export const INPUT_ARCHITECTURE = 'architecture';
|
||||||
export const INPUT_JAVA_PACKAGE = 'java-package';
|
export const INPUT_JAVA_PACKAGE = 'java-package';
|
||||||
export const INPUT_DISTRIBUTION = 'distribution';
|
export const INPUT_DISTRIBUTION = 'distribution';
|
||||||
|
|
|
@ -13,6 +13,7 @@ async function run() {
|
||||||
try {
|
try {
|
||||||
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
||||||
const distributionName = core.getInput(constants.INPUT_DISTRIBUTION, { required: true });
|
const distributionName = core.getInput(constants.INPUT_DISTRIBUTION, { required: true });
|
||||||
|
const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE);
|
||||||
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
|
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
|
||||||
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
|
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
|
||||||
const jdkFile = core.getInput(constants.INPUT_JDK_FILE);
|
const jdkFile = core.getInput(constants.INPUT_JDK_FILE);
|
||||||
|
@ -26,11 +27,14 @@ async function run() {
|
||||||
toolchainIds = [];
|
toolchainIds = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!versions.length && !versionFile) {
|
||||||
|
throw new Error("Java-version or java-version-file input expected");
|
||||||
|
}
|
||||||
|
|
||||||
if (!versions.length) {
|
if (!versions.length) {
|
||||||
core.debug('JAVA_VERSION input is empty, looking for .java-version file');
|
core.debug('Java-version input is empty, looking for java-version-file input');
|
||||||
const versionFileName = '.java-version';
|
|
||||||
const contents = fs
|
const contents = fs
|
||||||
.readFileSync(versionFileName)
|
.readFileSync(versionFile)
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
const semverRegExp = /(?<version>(?<=(^|\s|\-))(\d+\S*))(\s|$)/;
|
const semverRegExp = /(?<version>(?<=(^|\s|\-))(\d+\S*))(\s|$)/;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue