Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Db backup restore #877

Closed
wants to merge 10 commits into from
34 changes: 34 additions & 0 deletions .github/workflows/backup-db.yml
Original file line number Diff line number Diff line change
@@ -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
Loading