forked from actions/setup-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add output parameters for the tool path and version
This allows calling the action multiple times in the same job and retrieving the path and/or version in other steps. Fixes actions#65
- Loading branch information
Showing
6 changed files
with
123 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
if (!$args.Count -or !$args[0]) | ||
{ | ||
throw "Must supply java version argument" | ||
throw "::error::Must supply java version argument" | ||
} | ||
|
||
$java_version = & cmd.exe /c "java -version 2>&1" | Out-String | ||
Write-Host "Found java version: $java_version" | ||
if (!$java_version.Contains($args[0])) | ||
{ | ||
throw "Unexpected version" | ||
throw "::error::Unexpected version" | ||
} | ||
|
||
if ($args.Count -lt 2 -or !$args[1]) | ||
{ | ||
throw "::error::Must supply java path argument" | ||
} | ||
|
||
if ($args[1] -ne $Env:JAVA_HOME) | ||
{ | ||
throw "::error::Unexpected path" | ||
} | ||
|
||
if ($args.Count -lt 3 -or !$args[2]) | ||
{ | ||
throw "::error::Must supply java version argument" | ||
} | ||
|
||
if ($args[0] -ne $args[2]) | ||
{ | ||
throw "::error::Unexpected version" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "$1" ]; then | ||
echo "Must supply java version argument" | ||
echo "::error::Must supply java version argument" | ||
exit 1 | ||
fi | ||
|
||
java_version="$(java -version 2>&1)" | ||
echo "Found java version: $java_version" | ||
if [ -z "$(echo $java_version | grep --fixed-strings $1)" ]; then | ||
echo "Unexpected version" | ||
echo "::error::Unexpected version" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
echo "::error::Must supply java path argument" | ||
exit 1 | ||
fi | ||
|
||
if [ "$2" != "$JAVA_HOME" ]; then | ||
echo "::error::Unexpected path" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$3" ]; then | ||
echo "::error::Must supply java version argument" | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" != "$3" ]; then | ||
echo "::error::Unexpected version" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters