File tree Expand file tree Collapse file tree 6 files changed +121
-37
lines changed Expand file tree Collapse file tree 6 files changed +121
-37
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,16 @@ jobs:
35
35
if : runner.os == 'windows'
36
36
run : move "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
37
37
- name : Setup Java 13
38
+ id : setup-java
38
39
uses : ./
39
40
with :
40
41
java-version : 13.0.2
41
42
- name : Verify Java 13
42
43
if : runner.os != 'windows'
43
- run : __tests__/verify-java.sh 13.0.2
44
+ run : __tests__/verify-java.sh 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
44
45
- name : Verify Java 13 (Windows)
45
46
if : runner.os == 'windows'
46
- run : __tests__/verify-java.ps1 13.0.2
47
+ run : __tests__/verify-java.ps1 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
47
48
48
49
test-proxy :
49
50
runs-on : ubuntu-latest
@@ -62,11 +63,12 @@ jobs:
62
63
- name : Clear tool cache
63
64
run : rm -rf $RUNNER_TOOL_CACHE/*
64
65
- name : Setup Java 13
66
+ id : setup-java
65
67
uses : ./
66
68
with :
67
69
java-version : 13.0.2
68
70
- name : Verify Java 13
69
- run : __tests__/verify-java.sh 13.0.2
71
+ run : __tests__/verify-java.sh 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
70
72
71
73
test-bypass-proxy :
72
74
runs-on : ubuntu-latest
78
80
- name : Clear tool cache
79
81
run : rm -rf $RUNNER_TOOL_CACHE/*
80
82
- name : Setup Java 13
83
+ id : setup-java
81
84
uses : ./
82
85
with :
83
86
java-version : 13.0.2
84
87
- name : Verify Java 13
85
- run : __tests__/verify-java.sh 13.0.2
88
+ run : __tests__/verify-java.sh 13.0.2 "${{ steps.setup-java.outputs.path }}" "${{ steps.setup-java.outputs.version }}"
Original file line number Diff line number Diff line change @@ -9,3 +9,23 @@ if (!$java_version.Contains($args[0]))
9
9
{
10
10
throw " Unexpected version"
11
11
}
12
+
13
+ if ($args.Count -lt 2 -or ! $args [1 ])
14
+ {
15
+ throw " Must supply java path argument"
16
+ }
17
+
18
+ if ($args [1 ] -ne $Env: JAVA_HOME )
19
+ {
20
+ throw " Unexpected path"
21
+ }
22
+
23
+ if ($args.Count -lt 3 -or ! $args [2 ])
24
+ {
25
+ throw " Must supply java version argument"
26
+ }
27
+
28
+ if ($args [0 ] -ne $args [2 ])
29
+ {
30
+ throw " Unexpected version"
31
+ }
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
3
if [ -z " $1 " ]; then
4
- echo " Must supply java version argument"
4
+ echo " ::error:: Must supply java version argument"
5
5
exit 1
6
6
fi
7
7
8
8
java_version=" $( java -version 2>&1 ) "
9
9
echo " Found java version: $java_version "
10
10
if [ -z " $( echo $java_version | grep --fixed-strings $1 ) " ]; then
11
- echo " Unexpected version"
11
+ echo " ::error::Unexpected version"
12
+ exit 1
13
+ fi
14
+
15
+ if [ -z " $2 " ]; then
16
+ echo " ::error::Must supply java path argument"
17
+ exit 1
18
+ fi
19
+
20
+ if [ " $2 " != " $JAVA_HOME " ]; then
21
+ echo " ::error::Unexpected path"
22
+ exit 1
23
+ fi
24
+
25
+ if [ -z " $3 " ]; then
26
+ echo " ::error::Must supply java version argument"
27
+ exit 1
28
+ fi
29
+
30
+ if [ " $1 " != " $3 " ]; then
31
+ echo " ::error::Unexpected version"
12
32
exit 1
13
33
fi
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ inputs:
36
36
settings-path :
37
37
description : ' Path to where the settings.xml file will be written. Default is ~/.m2.'
38
38
required : false
39
+ outputs :
40
+ path :
41
+ description : ' Path to where the java environment has been installed (same as $JAVA_HOME)'
42
+ version :
43
+ description : ' Actual version of the java environment that has been installed'
39
44
runs :
40
45
using : ' node12'
41
46
main : ' dist/index.js'
Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ export async function getJava(
90
90
core . exportVariable ( 'JAVA_HOME' , toolPath ) ;
91
91
core . exportVariable ( extendedJavaHome , toolPath ) ;
92
92
core . addPath ( path . join ( toolPath , 'bin' ) ) ;
93
+ core . setOutput ( 'path' , toolPath ) ;
94
+ core . setOutput ( 'version' , version ) ;
93
95
}
94
96
95
97
function getCacheVersionString ( version : string ) {
You can’t perform that action at this time.
0 commit comments