Update build-and-release.yml

This commit is contained in:
THEMPGUYAlt 2025-06-20 15:11:15 -04:00 committed by GitHub
parent 08c7c775a3
commit 7a65d4642d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 2 deletions

View File

@ -18,10 +18,24 @@ jobs:
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up JDK 17 - name: Get Java version from pom.xml or fallback to 22
id: java
run: |
echo "Attempting to extract Java version from pom.xml..."
version=$(mvn help:evaluate -Dexpression=maven.compiler.source -q -DforceStdout)
if [[ -z "$version" || "$version" == *"[INFO]"* || "$version" == *"BUILD FAILURE"* ]]; then
version=$(mvn help:evaluate -Dexpression=java.version -q -DforceStdout)
fi
if [[ -z "$version" || "$version" == *"[INFO]"* || "$version" == *"BUILD FAILURE"* ]]; then
version="21"
echo "Falling back to Java version $version"
fi
echo "java=$version" >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '17' java-version: ${{ steps.java.outputs.java }}
distribution: 'temurin' distribution: 'temurin'
- name: Build with Maven - name: Build with Maven