Skip to content

Commit 475978b

Browse files
author
Danny McCormick
authored
Use java-version (#14)
1 parent cbc5ae3 commit 475978b

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ steps:
1919
- uses: actions/checkout@latest
2020
- uses: actions/setup-java@v1
2121
with:
22-
version: '9.0.4' // The JDK version to make available on the path. Takes a whole or semver Jdk version, or 1.x syntax (e.g. 1.8 => Jdk 8.x)
22+
java-version: '9.0.4' // The JDK version to make available on the path. Takes a whole or semver Jdk version, or 1.x syntax (e.g. 1.8 => Jdk 8.x)
2323
architecture: x64 // (x64 or x86) - defaults to x64
2424
- run: java -cp java HelloWorldApp
2525
```
@@ -30,7 +30,7 @@ steps:
3030
- uses: actions/checkout@master
3131
- uses: actions/setup-java@v1
3232
with:
33-
version: '4.0.0'
33+
java-version: '4.0.0'
3434
architecture: x64
3535
jdkFile: <path to jdkFile> // Optional - jdkFile to install java from. Useful for versions not supported by Azul
3636
- run: java -cp java HelloWorldApp
@@ -50,7 +50,7 @@ jobs:
5050
- name: Setup java
5151
uses: actions/setup-java@v1
5252
with:
53-
version: ${{ matrix.java }}
53+
java-version: ${{ matrix.java }}
5454
architecture: x64
5555
- run: java -cp java HelloWorldApp
5656
```

action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'Setup Java environment'
22
description: 'Setup your runner with Java'
33
author: 'GitHub'
44
inputs:
5-
version:
5+
java-version:
66
description: 'The JDK version to make available on the path. Takes a whole or semver Jdk version, or 1.x syntax (e.g. 1.8 => Jdk 8.x)'
77
required: true
88
architecture:
@@ -12,6 +12,9 @@ inputs:
1212
jdkFile:
1313
description: 'Path to where the compressed JDK is located. The path could be in your source repository or a local path on the agent.'
1414
required: false
15+
# Deprecated option, do not use. Will not be supported after October 1, 2019
16+
version:
17+
description: 'Deprecated. Use java-version instead. Will not be supported after October 1, 2019'
1518
runs:
1619
using: 'node12'
1720
main: 'lib/setup-java.js'

lib/setup-java.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ const path = __importStar(require("path"));
2121
function run() {
2222
return __awaiter(this, void 0, void 0, function* () {
2323
try {
24-
const version = core.getInput('version', { required: true });
24+
let version = core.getInput('version');
25+
if (!version) {
26+
version = core.getInput('java-version', { required: true });
27+
}
2528
const arch = core.getInput('architecture', { required: true });
2629
const jdkFile = core.getInput('jdkFile', { required: false }) || '';
2730
yield installer.getJava(version, arch, jdkFile);

src/setup-java.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import * as path from 'path';
44

55
async function run() {
66
try {
7-
const version = core.getInput('version', {required: true});
7+
let version = core.getInput('version');
8+
if (!version) {
9+
version = core.getInput('java-version', {required: true});
10+
}
811
const arch = core.getInput('architecture', {required: true});
912
const jdkFile = core.getInput('jdkFile', {required: false}) || '';
1013

0 commit comments

Comments
 (0)