Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
475978becf | ||
|
|
cbc5ae3642 | ||
|
|
1d41734431 | ||
|
|
232795a7c4 |
13
README.md
13
README.md
@@ -1,5 +1,9 @@
|
|||||||
# setup-java
|
# setup-java
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<a href="https://github.com/actions/setup-java"><img alt="GitHub Actions status" src="https://github.com/actions/setup-java/workflows/Main%20workflow/badge.svg"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
This action sets up a java environment for use in actions by:
|
This action sets up a java environment for use in actions by:
|
||||||
|
|
||||||
- optionally downloading and caching a version of java by version and adding to PATH. Downloads from [Azul's Zulu distribution](http://static.azul.com/zulu/bin/).
|
- optionally downloading and caching a version of java by version and adding to PATH. Downloads from [Azul's Zulu distribution](http://static.azul.com/zulu/bin/).
|
||||||
@@ -15,7 +19,7 @@ steps:
|
|||||||
- uses: actions/checkout@latest
|
- uses: actions/checkout@latest
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
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)
|
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)
|
||||||
architecture: x64 // (x64 or x86) - defaults to x64
|
architecture: x64 // (x64 or x86) - defaults to x64
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
@@ -26,7 +30,7 @@ steps:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
version: 4.0.0
|
java-version: '4.0.0'
|
||||||
architecture: x64
|
architecture: x64
|
||||||
jdkFile: <path to jdkFile> // Optional - jdkFile to install java from. Useful for versions not supported by Azul
|
jdkFile: <path to jdkFile> // Optional - jdkFile to install java from. Useful for versions not supported by Azul
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
@@ -36,16 +40,17 @@ Matrix Testing:
|
|||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
runs-on: ubuntu-16.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [ 1.6, 9.0.x, 12.0.2 ]
|
java: [ '1.6', '9.0.x', '12.0.2' ]
|
||||||
name: Java ${{ matrix.java }} sample
|
name: Java ${{ matrix.java }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
name: 'Setup Java Action'
|
name: 'Setup Java environment'
|
||||||
description: 'Setup your runner with Java'
|
description: 'Setup your runner with Java'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
java-version:
|
||||||
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)'
|
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)'
|
||||||
required: true
|
required: true
|
||||||
architecture:
|
architecture:
|
||||||
@@ -12,6 +12,9 @@ inputs:
|
|||||||
jdkFile:
|
jdkFile:
|
||||||
description: 'Path to where the compressed JDK is located. The path could be in your source repository or a local path on the agent.'
|
description: 'Path to where the compressed JDK is located. The path could be in your source repository or a local path on the agent.'
|
||||||
required: false
|
required: false
|
||||||
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
|
version:
|
||||||
|
description: 'Deprecated. Use java-version instead. Will not be supported after October 1, 2019'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-java.js'
|
main: 'lib/setup-java.js'
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ const path = __importStar(require("path"));
|
|||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version', { required: true });
|
let version = core.getInput('version');
|
||||||
|
if (!version) {
|
||||||
|
version = core.getInput('java-version', { required: true });
|
||||||
|
}
|
||||||
const arch = core.getInput('architecture', { required: true });
|
const arch = core.getInput('architecture', { required: true });
|
||||||
const jdkFile = core.getInput('jdkFile', { required: false }) || '';
|
const jdkFile = core.getInput('jdkFile', { required: false }) || '';
|
||||||
yield installer.getJava(version, arch, jdkFile);
|
yield installer.getJava(version, arch, jdkFile);
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import * as path from 'path';
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version', {required: true});
|
let version = core.getInput('version');
|
||||||
|
if (!version) {
|
||||||
|
version = core.getInput('java-version', {required: true});
|
||||||
|
}
|
||||||
const arch = core.getInput('architecture', {required: true});
|
const arch = core.getInput('architecture', {required: true});
|
||||||
const jdkFile = core.getInput('jdkFile', {required: false}) || '';
|
const jdkFile = core.getInput('jdkFile', {required: false}) || '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user