This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
Db backup restore #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Supa-backup | |
on: | |
push: | |
branches: [ development ] | |
pull_request: | |
branches: [ development ] | |
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 | |
with: | |
ref: ${{ github.head_ref }} | |
- 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 |