mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
parse version
This commit is contained in:
parent
680565b9c5
commit
8dcd17f2ef
2 changed files with 6 additions and 0 deletions
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
|
@ -105044,6 +105044,7 @@ const constants = __importStar(__nccwpck_require__(9042));
|
||||||
const cache_1 = __nccwpck_require__(4810);
|
const cache_1 = __nccwpck_require__(4810);
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const distribution_factory_1 = __nccwpck_require__(924);
|
const distribution_factory_1 = __nccwpck_require__(924);
|
||||||
|
const semver = __importStar(__nccwpck_require__(1383));
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
@ -105059,6 +105060,8 @@ function run() {
|
||||||
core.debug("JAVA_VERSION input is empty, looking for .java-version file");
|
core.debug("JAVA_VERSION input is empty, looking for .java-version file");
|
||||||
const versionFileName = '.java-version';
|
const versionFileName = '.java-version';
|
||||||
const contents = fs_1.default.readFileSync(versionFileName).toString().trim();
|
const contents = fs_1.default.readFileSync(versionFileName).toString().trim();
|
||||||
|
const version = semver.valid(contents);
|
||||||
|
core.info(version ? version : "not found");
|
||||||
versions.push(contents);
|
versions.push(contents);
|
||||||
}
|
}
|
||||||
if (versions.length !== toolchainIds.length) {
|
if (versions.length !== toolchainIds.length) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { restore } from './cache';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { getJavaDistribution } from './distributions/distribution-factory';
|
import { getJavaDistribution } from './distributions/distribution-factory';
|
||||||
import { JavaInstallerOptions } from './distributions/base-models';
|
import { JavaInstallerOptions } from './distributions/base-models';
|
||||||
|
import * as semver from 'semver';
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
@ -24,6 +25,8 @@ async function run() {
|
||||||
core.debug("JAVA_VERSION input is empty, looking for .java-version file")
|
core.debug("JAVA_VERSION input is empty, looking for .java-version file")
|
||||||
const versionFileName = '.java-version'
|
const versionFileName = '.java-version'
|
||||||
const contents = fs.readFileSync(versionFileName).toString().trim();
|
const contents = fs.readFileSync(versionFileName).toString().trim();
|
||||||
|
const version = semver.valid(contents);
|
||||||
|
core.info(version ? version : "not found")
|
||||||
versions.push(contents)
|
versions.push(contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue