0
0
Fork 0
mirror of https://github.com/tj-actions/install-postgresql.git synced 2024-12-20 01:18:18 +00:00

Updated the PATH regardless of cache hit outcome

This commit is contained in:
Tonye Jack 2023-09-12 11:11:05 -06:00
parent e9a9096690
commit 8e47058fa9
3 changed files with 26 additions and 14 deletions

View file

@ -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_<VARIABLE_NAME> 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

View file

@ -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::"

17
update-path.sh Normal file
View file

@ -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::"