Skip to content

Commit de72ab8

Browse files
committed
simplify jdk extraction from pom
1 parent e6b332a commit de72ab8

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
name: extract-jdk-version
22
description: extract-jdk-version from pom.xml
33

4-
inputs:
5-
version-file:
6-
default: pom.xml
7-
description: "Path to VERSION file (default: 'pom.xml')"
8-
required: false
94
outputs:
105
version:
116
description: Extracted jdk version
@@ -18,10 +13,5 @@ runs:
1813
id: extract
1914
shell: bash
2015
run: |
21-
if [[ "${{ inputs.version-file }}" == *"pom.xml" ]]; then
22-
VERSION=$(grep -m 1 "<java.version>" "${{ inputs.version-file }}" | sed 's/.*<java.version>\(.*\)<\/java.version>.*/\1/' | tr -d '\n\r' | xargs)
23-
else
24-
# Use VERSION file
25-
VERSION=$(cat "${{ inputs.version-file }}" | tr -d '\n\r' | xargs)
26-
fi
16+
VERSION=$(grep -m 1 "<java.version>" "${{ inputs.version-file }}" | sed 's/.*<java.version>\(.*\)<\/java.version>.*/\1/' | tr -d '\n\r' | xargs)
2717
echo "version=$VERSION" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)