Skip to content

Commit

Permalink
parse version
Browse files Browse the repository at this point in the history
  • Loading branch information
e-korolevskii committed Nov 24, 2022
1 parent 680565b commit 8dcd17f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105044,6 +105044,7 @@ const constants = __importStar(__nccwpck_require__(9042));
const cache_1 = __nccwpck_require__(4810);
const path = __importStar(__nccwpck_require__(1017));
const distribution_factory_1 = __nccwpck_require__(924);
const semver = __importStar(__nccwpck_require__(1383));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand All @@ -105059,6 +105060,8 @@ function run() {
core.debug("JAVA_VERSION input is empty, looking for .java-version file");
const versionFileName = '.java-version';
const contents = fs_1.default.readFileSync(versionFileName).toString().trim();
const version = semver.valid(contents);
core.info(version ? version : "not found");
versions.push(contents);
}
if (versions.length !== toolchainIds.length) {
Expand Down
3 changes: 3 additions & 0 deletions src/setup-java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { restore } from './cache';
import * as path from 'path';
import { getJavaDistribution } from './distributions/distribution-factory';
import { JavaInstallerOptions } from './distributions/base-models';
import * as semver from 'semver';

async function run() {
try {
Expand All @@ -24,6 +25,8 @@ async function run() {
core.debug("JAVA_VERSION input is empty, looking for .java-version file")
const versionFileName = '.java-version'
const contents = fs.readFileSync(versionFileName).toString().trim();
const version = semver.valid(contents);
core.info(version ? version : "not found")
versions.push(contents)
}

Expand Down

0 comments on commit 8dcd17f

Please sign in to comment.