mirror of
https://github.com/tj-actions/install-postgresql.git
synced 2024-12-20 01:18:18 +00:00
feat: add support for caching
This commit is contained in:
parent
39233dcfab
commit
fcd2d09e4b
1 changed files with 21 additions and 0 deletions
21
action.yml
21
action.yml
|
@ -9,6 +9,27 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Get cache directory
|
||||||
|
id: cache-dir
|
||||||
|
run: |
|
||||||
|
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
||||||
|
cache_dir=$(apt-cache policy postgresql-${{ inputs.postgresql_version }} | awk '/Filename/ {print $2}')
|
||||||
|
elif [[ "${{ runner.os }}" == "macOS" ]]; then
|
||||||
|
cache_dir=$(brew --cache postgresql@${{ inputs.postgresql_version }})
|
||||||
|
elif [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||||
|
cache_dir=$(choco search postgresql${{ inputs.postgresql_version }} --exact --limit-output | grep "^postgresql " | awk '{print $NF}')
|
||||||
|
fi
|
||||||
|
echo "::set-output name=cache_dir::$cache_dir"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ steps.cache-dir.outputs.cache_dir }}
|
||||||
|
key: ${{ runner.os }}-postgresql-${{ inputs.postgresql_version }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-postgresql-
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
bash $GITHUB_ACTION_PATH/entrypoint.sh
|
bash $GITHUB_ACTION_PATH/entrypoint.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
Loading…
Add table
Reference in a new issue