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:
3535 if : runner.os == 'windows'
3636 run : move "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
3737 - name : Setup Java 13
38+ id : setup-java
3839 uses : ./
3940 with :
4041 java-version : 13.0.2
4142 - name : Verify Java 13
4243 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 }}"
4445 - name : Verify Java 13 (Windows)
4546 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 }}"
4748
4849 test-proxy :
4950 runs-on : ubuntu-latest
@@ -62,11 +63,12 @@ jobs:
6263 - name : Clear tool cache
6364 run : rm -rf $RUNNER_TOOL_CACHE/*
6465 - name : Setup Java 13
66+ id : setup-java
6567 uses : ./
6668 with :
6769 java-version : 13.0.2
6870 - 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 }}"
7072
7173 test-bypass-proxy :
7274 runs-on : ubuntu-latest
7880 - name : Clear tool cache
7981 run : rm -rf $RUNNER_TOOL_CACHE/*
8082 - name : Setup Java 13
83+ id : setup-java
8184 uses : ./
8285 with :
8386 java-version : 13.0.2
8487 - 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]))
99{
1010 throw " Unexpected version"
1111}
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 11#! /bin/sh
22
33if [ -z " $1 " ]; then
4- echo " Must supply java version argument"
4+ echo " ::error:: Must supply java version argument"
55 exit 1
66fi
77
88java_version=" $( java -version 2>&1 ) "
99echo " Found java version: $java_version "
1010if [ -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"
1232 exit 1
1333fi
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ inputs:
3636 settings-path :
3737 description : ' Path to where the settings.xml file will be written. Default is ~/.m2.'
3838 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'
3944runs :
4045 using : ' node12'
4146 main : ' dist/index.js'
Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ export async function getJava(
9090 core . exportVariable ( 'JAVA_HOME' , toolPath ) ;
9191 core . exportVariable ( extendedJavaHome , toolPath ) ;
9292 core . addPath ( path . join ( toolPath , 'bin' ) ) ;
93+ core . setOutput ( 'path' , toolPath ) ;
94+ core . setOutput ( 'version' , version ) ;
9395}
9496
9597function getCacheVersionString ( version : string ) {
You can’t perform that action at this time.
0 commit comments