Skip to content

Supa-backup

Supa-backup #73

Workflow file for this run

name: Supa-backup
on:
# push:
# branches: [ main ]
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight
jobs:
run_db_backup:
runs-on: ubuntu-latest
permissions:
contents: write
env:
supabase_db_url: ${{ secrets.SUPABASE_DB_URL }} # For example: postgresql://postgres:[YOUR-PASSWORD]@db.<ref>.supabase.co:5432/postgres
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: supabase/setup-cli@v1
with:
version: latest
- name: Backup roles
run: supabase db dump --db-url "$supabase_db_url" -f roles.sql --role-only
- name: Backup schema
run: supabase db dump --db-url "$supabase_db_url" -f schema.sql
- name: Backup data
run: supabase db dump --db-url "$supabase_db_url" -f data.sql --data-only --use-copy
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Supabase backup