ci: migrate GitHub actions to Gitea actions
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
BACKUP_DIR="./server/data/backups"
|
||||
DB_CONTAINER="andrekniede-umami-db-1"
|
||||
DB_USER="postgres"
|
||||
DB_NAME="postgres" # Defaults for the postgres image unless otherwise specified
|
||||
DATE=$(date +"%Y-%m-%d")
|
||||
BACKUP_FILE="$BACKUP_DIR/umami-backup-$DATE.sql"
|
||||
|
||||
# Create backup directory if it doesn't exist
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
# Dump the database
|
||||
echo "Dumping Umami database..."
|
||||
docker exec -t $DB_CONTAINER pg_dump -c -U $DB_USER > "$BACKUP_FILE"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Database dump successful."
|
||||
|
||||
# Git operations
|
||||
git add "$BACKUP_FILE"
|
||||
git commit -m "chore: automated umami database backup $DATE"
|
||||
git push
|
||||
|
||||
echo "Backup pushed to repository."
|
||||
else
|
||||
echo "Error during database dump."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user