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
|
- main
|
||||||
|
|
||||||
jobs:
|
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:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Test postgres-restore
|
name: Test postgres-restore
|
||||||
|
|
10
action.yml
10
action.yml
|
@ -20,9 +20,15 @@ runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p $(dirname "${{ inputs.path }}")
|
bash $GITHUB_ACTION_PATH/entrypoint.sh
|
||||||
pg_dump ${{ inputs.options }} -d "${{ inputs.database_url }}" > "${{ inputs.path }}"
|
|
||||||
shell: bash
|
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:
|
branding:
|
||||||
icon: hard-drive
|
icon: hard-drive
|
||||||
color: white
|
color: white
|
||||||
|
|
17
entrypoint.sh
Normal file → Executable file
17
entrypoint.sh
Normal file → Executable file
|
@ -1,3 +1,20 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
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