mirror of
https://github.com/tj-actions/pg-dump.git
synced 2024-12-20 01:18:49 +00:00
Updated the script
This commit is contained in:
parent
ccd8792e24
commit
68260fe408
3 changed files with 34 additions and 2 deletions
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
|
@ -9,6 +9,15 @@ on:
|
|||
- main
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
name: Run shellcheck
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1.19
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test postgres-restore
|
||||
|
|
10
action.yml
10
action.yml
|
@ -20,9 +20,15 @@ runs:
|
|||
using: 'composite'
|
||||
steps:
|
||||
- run: |
|
||||
mkdir -p $(dirname "${{ inputs.path }}")
|
||||
pg_dump ${{ inputs.options }} -d "${{ inputs.database_url }}" > "${{ inputs.path }}"
|
||||
bash $GITHUB_ACTION_PATH/entrypoint.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 }}
|
||||
INPUT_PATH: ${{ inputs.path }}
|
||||
INPUT_DATABASE_URL: ${{ inputs.database_url }}
|
||||
INPUT_OPTIONS: ${{ inputs.options }}
|
||||
branding:
|
||||
icon: hard-drive
|
||||
color: white
|
||||
|
|
17
entrypoint.sh
Normal file → Executable file
17
entrypoint.sh
Normal file → Executable file
|
@ -1,3 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "::group::pg-dump"
|
||||
|
||||
echo "Creating the output directory..."
|
||||
|
||||
mkdir -p $(dirname "$INPUT_PATH")
|
||||
|
||||
echo "Created the output directory"
|
||||
|
||||
echo "Running pg_dump..."
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
pg_dump $INPUT_OPTIONS -d "$INPUT_DATABASE_URL" > "$INPUT_PATH"
|
||||
|
||||
echo "Complete"
|
||||
|
||||
echo "::endgroup::"
|
Loading…
Add table
Reference in a new issue