mirror of
https://github.com/tj-actions/pg-dump.git
synced 2024-12-20 01:18:49 +00:00
Initial commit.
This commit is contained in:
commit
4ed55614ba
11 changed files with 221 additions and 0 deletions
10
.github/ISSUE_TEMPLATE.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
* pg-dump:
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Describe what you were trying to get done.
|
||||||
|
Tell us what happened, what went wrong, and what you expected to happen.
|
||||||
|
|
||||||
|
### What I Did
|
||||||
|
|
||||||
|
Add some details about your workflow ?
|
18
.github/workflows/rebase.yml
vendored
Normal file
18
.github/workflows/rebase.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
name: Automatic Rebase
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
jobs:
|
||||||
|
rebase:
|
||||||
|
name: Rebase
|
||||||
|
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT_TOKEN }}
|
||||||
|
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
|
||||||
|
- name: Automatic Rebase
|
||||||
|
uses: cirrus-actions/rebase@1.4
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
|
27
.github/workflows/sync-release-version.yml
vendored
Normal file
27
.github/workflows/sync-release-version.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: Update release version.
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Bumpversion release version
|
||||||
|
uses: tj-actions/bumpversion@v7.1
|
||||||
|
id: bumpversion
|
||||||
|
with:
|
||||||
|
pattern: 'tj-actions/pg-dump@'
|
||||||
|
paths: |
|
||||||
|
README.md
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
base: "main"
|
||||||
|
title: "Upgraded to ${{ steps.bumpversion.outputs.new_version }}"
|
||||||
|
branch: "upgrade-to-${{ steps.bumpversion.outputs.new_version }}"
|
||||||
|
commit-message: "Upgraded from ${{ steps.bumpversion.outputs.old_version }} -> ${{ steps.bumpversion.outputs.new_version }}"
|
||||||
|
body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/${{ steps.bumpversion.outputs.old_version }}...${{ steps.bumpversion.outputs.new_version }})"
|
||||||
|
token: ${{ secrets.PAT_TOKEN }}
|
55
.github/workflows/test.yml
vendored
Normal file
55
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test postgres-restore
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:9.6
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: test_user
|
||||||
|
POSTGRES_PASSWORD: test_user_password
|
||||||
|
POSTGRES_DB: testdb
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
# needed because the postgres container does not provide a healthcheck
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Run pg_dump
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
database_url: "postgres://test_user:test_user_password@localhost:5432/testdb"
|
||||||
|
path: "backups/backup.sql"
|
||||||
|
|
||||||
|
- name: Check changes to backup file.
|
||||||
|
id: changed_backup
|
||||||
|
uses: tj-actions/verify-changed-files@v5.1
|
||||||
|
with:
|
||||||
|
files: backups/backup.sql
|
||||||
|
|
||||||
|
- name: Commit changes to backup file.
|
||||||
|
if: steps.changed_backup.outputs.files_changed == 'true'
|
||||||
|
run: |
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git add backups/backup.sql
|
||||||
|
git commit -m "Auto update backup.sql."
|
||||||
|
|
||||||
|
- name: Push changes
|
||||||
|
if: steps.changed_backup.outputs.files_changed == 'true'
|
||||||
|
uses: ad-m/github-push-action@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.PAT_TOKEN }}
|
||||||
|
branch: ${{ github.head_ref }}
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.idea/
|
||||||
|
.envrc
|
0
CONTRIBUTING.md
Normal file
0
CONTRIBUTING.md
Normal file
9
Dockerfile
Normal file
9
Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM alpine:3.13.0
|
||||||
|
|
||||||
|
LABEL maintainer="Tonye Jack <jtonye@ymail.com>"
|
||||||
|
|
||||||
|
RUN apk add bash
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
7
HISTORY.md
Normal file
7
HISTORY.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
History
|
||||||
|
-------
|
||||||
|
|
||||||
|
v1 (2021-01-30)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Initial Release.
|
22
LICENSE
Normal file
22
LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021, Tonye Jack
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
47
README.md
Normal file
47
README.md
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
pg-dump
|
||||||
|
-------
|
||||||
|
|
||||||
|
Run pg_dump to generate a backup
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Postgres Dump Backup
|
||||||
|
uses: tj-actions/pg-dump@v1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
| Input | type | required | default | description |
|
||||||
|
|:-------------:|:-----------:|:-------------:|:----------------------------:|:-------------:|
|
||||||
|
| token | `string` | `true` | `${{ github.token }}` | [GITHUB_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Free software: [MIT license](LICENSE)
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* TODO
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
-------
|
||||||
|
|
||||||
|
This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Report Bugs
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Report bugs at https://github.com/tj-actions/pg-dump/issues.
|
||||||
|
|
||||||
|
If you are reporting a bug, please include:
|
||||||
|
|
||||||
|
* Your operating system name and version.
|
||||||
|
* Any details about your workflow that might be helpful in troubleshooting.
|
||||||
|
* Detailed steps to reproduce the bug.
|
24
action.yml
Normal file
24
action.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
name: Postgres Dump Backup
|
||||||
|
description: Run pg_dump to generate a backup
|
||||||
|
author: tj-actions
|
||||||
|
inputs:
|
||||||
|
database_url:
|
||||||
|
description: 'Database URL'
|
||||||
|
required: true
|
||||||
|
path:
|
||||||
|
description: 'Backup file output location'
|
||||||
|
required: true
|
||||||
|
args:
|
||||||
|
description: 'Extra arguments passed to pg_dump'
|
||||||
|
required: true
|
||||||
|
default: '-O'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
pg_dump "${{ inputs.args }}" -d "${{ inputs.database_url }}" > "${{ inputs.path }}"
|
||||||
|
shell: bash
|
||||||
|
branding:
|
||||||
|
icon: hard-drive
|
||||||
|
color: white
|
Loading…
Add table
Reference in a new issue