From e8160e723c17458607828884ae8ff88b39a78b29 Mon Sep 17 00:00:00 2001 From: Pawel Palucha Date: Wed, 26 Apr 2023 12:59:44 +0200 Subject: [PATCH 1/3] Prepare maven wrapper at action start Make sure downloading and uncompressing maven wrapper doesn't contaminate commands' outputs. --- action.yml | 4 ++++ prepare_maven_wrapper.sh | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100755 prepare_maven_wrapper.sh diff --git a/action.yml b/action.yml index 50dea4c..92fbd04 100644 --- a/action.yml +++ b/action.yml @@ -148,6 +148,10 @@ runs: run: git config --global user.name "${{ inputs.gitUserName }}" && git config --global user.email "${{ inputs.gitUserEmail }}" shell: bash working-directory: "${{ inputs.workingDirectory }}" + - name: "Prepare maven wrapper" + run: ${{ github.action_path }}/prepare_maven_wrapper.sh + shell: bash + working-directory: "${{ inputs.workingDirectory }}" - name: "Export release version" id: version run: ${{ github.action_path }}/export_version.sh diff --git a/prepare_maven_wrapper.sh b/prepare_maven_wrapper.sh new file mode 100755 index 0000000..3cbe435 --- /dev/null +++ b/prepare_maven_wrapper.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail +[[ $TRACE_ENABLED == "true" ]] && set -x + +# If we are using maven wrapper, make sure it's downloaded. Otherwise downloading/uncompressing +# may contaminate commands outputs. +${MAVEN_BIN} -f "${MAVEN_PROJECT_POM}" --version From d911d36459a23ebf9026fd93efa2860481313270 Mon Sep 17 00:00:00 2001 From: Pawel Palucha Date: Wed, 26 Apr 2023 13:09:12 +0200 Subject: [PATCH 2/3] Use help:evaluate for printing maven expressions This seems to behave better than exec:exec with echo. --- common.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common.sh b/common.sh index 61adc2c..99fc5ea 100755 --- a/common.sh +++ b/common.sh @@ -91,11 +91,10 @@ function mavenMetadataPath() { } function mavenProjectVersion() { - ${MAVEN_BIN} -f ${MAVEN_PROJECT_POM} -q \ - -Dexec.executable=echo \ - -Dexec.args='${project.version}' \ - --non-recursive \ - exec:exec + ${MAVEN_BIN} -f "${MAVEN_PROJECT_POM}" -q \ + help:evaluate \ + -Dexpression=project.version \ + -DforceStdout } function set_output() { From 0686ec2f66a0c024c11da7d69f213dd02d2be56b Mon Sep 17 00:00:00 2001 From: Pawel Palucha Date: Wed, 26 Apr 2023 13:11:04 +0200 Subject: [PATCH 3/3] Replace depreciated GHA set_output command --- common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common.sh b/common.sh index 99fc5ea..f6c148b 100755 --- a/common.sh +++ b/common.sh @@ -100,5 +100,10 @@ function mavenProjectVersion() { function set_output() { # $1 = key # $2 = value - echo "::set-output name=${1}::${2}" + delimiter="$(openssl rand -hex 8)" + { + echo "${1}<<${delimiter}" + echo "$2" + echo "${delimiter}" + } >> "$GITHUB_OUTPUT" }