-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.java-version file support #113
Comments
I'd like to add here that it would be awesome if the content of that file is used by default if present. Basically making the |
I found a way to add support for - name: Export .java-version
run: |
java_version=11
if [[ -f .java-version ]]; then
java_version=$(head -1 .java-version)
else
echo "::error file=.java-version::Missing .java-version file, falling back to default Java version: $java_version"
fi
echo "JAVA_VERSION=$java_version" >>"$GITHUB_ENV"
- uses: actions/setup-java@v2
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }} This can of course be simplified if you use it in a repository where the - name: Export .java-version
run: echo "JAVA_VERSION=$(head -1 .java-version)" >>"$GITHUB_ENV"
- uses: actions/setup-java@v2
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }} |
I got tired and created a wrapping action: https://github.com/Fleshgrinder/setup-java |
Hello everyone. Sorry for the late response. We released a version of setup-java to pass a |
I'm closing this feature request as completed. Related release: https://github.com/actions/setup-java/releases/tag/v3.9.0 |
Hello, I think it would be nice to set
java-version
default value by reading.java-version
file if it exists, what do you think?This change is inspired by ruby-setup action which already does the same with
.ruby-version
file. The use of.java-vesion
file is popularized by jenv.The text was updated successfully, but these errors were encountered: