Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db backup restore #877

Closed
wants to merge 10 commits into from
34 changes: 34 additions & 0 deletions .github/workflows/backup-db.yml
@@ -0,0 +1,34 @@
name: Supa-backup

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
run_db_backup:
runs-on: ubuntu-latest
permissions:
contents: write
env:
supabase_db_url: ${{ secrets.SUPABASE_DB_URL }}
steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- name: Generate timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +'%Y%m%d%H%M%S')"

- name: Backup schema
run: supabase db dump --db-url "$supabase_db_url" -f ${{ steps.timestamp.outputs.timestamp }}_schema.sql

- name: Backup data
run: supabase db dump --db-url "$supabase_db_url" -f ${{ steps.timestamp.outputs.timestamp }}_data.sql --data-only --use-copy

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Supabase backup