From 8e47058fa9ed23724032d8ebd6d5038b0354d13f Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 12 Sep 2023 11:11:05 -0600 Subject: [PATCH] Updated the PATH regardless of cache hit outcome --- action.yml | 9 +++++++++ entrypoint.sh | 14 -------------- update-path.sh | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 update-path.sh diff --git a/action.yml b/action.yml index 117f5ba..11d1f31 100644 --- a/action.yml +++ b/action.yml @@ -48,6 +48,15 @@ runs: # https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611 INPUT_POSTGRESQL_VERSION: ${{ inputs.postgresql_version }} + - name: Update PATH + run: | + bash $GITHUB_ACTION_PATH/update-path.sh + shell: bash + env: + # INPUT_ is not available in Composite run steps + # https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611 + INPUT_POSTGRESQL_VERSION: ${{ inputs.postgresql_version }} + - name: Verify PostgreSQL run: | # Check the postgresql version diff --git a/entrypoint.sh b/entrypoint.sh index 351ce61..db9cef9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -48,18 +48,4 @@ fi echo "Installed postgresql" -echo "Updating PATH..." - -# Verify installation by running pg_dump directly -if [[ "$(uname -s)" == "NT"* ]] || [[ "$(uname -s)" == "MINGW"* ]] || [[ "$(uname -s)" == *"MSYS"* ]]; then - # shellcheck disable=SC2028 - echo "C:\\Program Files\\PostgreSQL\\$INPUT_POSTGRESQL_VERSION\\bin" >> "$GITHUB_PATH" -elif [[ "$(uname -s)" == "Darwin" ]]; then - echo "/usr/local/opt/postgresql@${INPUT_POSTGRESQL_VERSION}/bin" >> "$GITHUB_PATH" -else - echo "/usr/lib/postgresql/$INPUT_POSTGRESQL_VERSION/bin" >> "$GITHUB_PATH" -fi - -echo "Complete" - echo "::endgroup::" diff --git a/update-path.sh b/update-path.sh new file mode 100644 index 0000000..2519e37 --- /dev/null +++ b/update-path.sh @@ -0,0 +1,17 @@ +echo "::group::set-postgres-path" + +echo "Updating PATH..." + +# Verify installation by running pg_dump directly +if [[ "$(uname -s)" == "NT"* ]] || [[ "$(uname -s)" == "MINGW"* ]] || [[ "$(uname -s)" == *"MSYS"* ]]; then + # shellcheck disable=SC2028 + echo "C:\\Program Files\\PostgreSQL\\$INPUT_POSTGRESQL_VERSION\\bin" >> "$GITHUB_PATH" +elif [[ "$(uname -s)" == "Darwin" ]]; then + echo "/usr/local/opt/postgresql@${INPUT_POSTGRESQL_VERSION}/bin" >> "$GITHUB_PATH" +else + echo "/usr/lib/postgresql/$INPUT_POSTGRESQL_VERSION/bin" >> "$GITHUB_PATH" +fi + +echo "Complete" + +echo "::endgroup::" \ No newline at end of file