Skip to content

Commit 78cce4a

Browse files
authored
Update action.yml
1 parent 67dd6de commit 78cce4a

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

  • action-templates/actions/action-maven-build

action-templates/actions/action-maven-build/action.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,27 @@ runs:
3535
shell: bash
3636
env:
3737
APP_PATH: ${{inputs.app-path}}
38+
JAVA_VERSION: ${{ inputs.java-version }}
3839
run: |
3940
# Check if the input java-version is empty
40-
if [ -z "${{ inputs.java-version }}" ]; then
41+
if [ -z "$JAVA_VERSION" ]; then
4142
# Extract from pom.xml if input is empty
42-
VERSION=$(grep -oP '(?<=<(java.version)>)[^<]+' "$APP_PATH/pom.xml" | head -n 1)
43-
else
44-
# Use the provided input
45-
VERSION="${{ inputs.java-version }}"
43+
JAVA_VERSION=$(grep -oP '(?<=<(java.version)>)[^<]+' "$APP_PATH/pom.xml" | head -n 1)
4644
fi
4745
4846
# Fail the build if no version could be determined at all
49-
if [ -z "$VERSION" ]; then
47+
if [ -z "$JAVA_VERSION" ]; then
5048
echo "Error: Java version could not be determined!"
5149
exit 1
5250
fi
5351
5452
# Save the version to step outputs
55-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
56-
57-
58-
53+
echo "java-version=$JAVA_VERSION" >> "$GITHUB_OUTPUT"
54+
5955
- name: Set up JDK
6056
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
6157
with:
62-
java-version: ${{ steps.get-java-version.outputs.version }}
58+
java-version: ${{ steps.get-java-version.outputs.java-version }}
6359
distribution: "temurin"
6460
cache: "maven"
6561
cache-dependency-path: "./${{inputs.app-path}}/pom.xml"

0 commit comments

Comments
 (0)