Add daily backup workflow for Neon database

This commit is contained in:
Janpeter Visser 2026-04-30 07:55:31 +02:00 committed by GitHub
parent c6fdd45d98
commit 9beb831da5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

38
.github/workflows/neon-backup.yml vendored Normal file
View file

@ -0,0 +1,38 @@
name: Daily Neon Database Backup
on:
schedule:
# Elke nacht om 02:00 UTC = 04:00 Nederlandse zomertijd / 03:00 wintertijd
- cron: "0 2 * * *"
# Hiermee kun je handmatig testen via GitHub
workflow_dispatch:
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Install PostgreSQL client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Create backup
env:
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL }}
run: |
mkdir -p backups
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
pg_dump "$DATABASE_URL" \
--format=custom \
--no-owner \
--no-privileges \
--file="backups/neon-backup-$DATE.dump"
- name: Upload backup artifact
uses: actions/upload-artifact@v4
with:
name: neon-database-backup
path: backups/*.dump
retention-days: 30