Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:
set -e

echo "Dumping specific databases..."
mongodump --uri "${{ secrets.MONGODB_URI }}" --db test --out ./temp_backup
mongodump --uri "${{ secrets.MONGODB_URI }}" --db pbctf --out ./temp_backup

TIMESTAMP=$(date -u +%Y-%m-%dT%H-%M-%SZ)

echo "Restoring databases..."
mongorestore --uri "${{ secrets.BACKUP_URI }}" --db "test-$TIMESTAMP" --drop ./temp_backup/test
mongorestore --uri "${{ secrets.BACKUP_URI }}" --nsFrom="pbctf.*" --nsTo="pbctf-$TIMESTAMP.*" --drop ./temp_backup

echo "Backup completed successfully for $TIMESTAMP"

Expand All @@ -43,7 +43,7 @@ jobs:
const maxBackups = parseInt(process.env.MAX_BACKUPS);

// Cleanup
const testBackups = dbs.filter(name => name.startsWith("test-")).sort();
const testBackups = dbs.filter(name => name.startsWith("pbctf-")).sort();
if (testBackups.length > maxBackups) {
const backupsToDelete = testBackups.slice(0, testBackups.length - maxBackups);
backupsToDelete.forEach(dbName => {
Expand All @@ -58,4 +58,4 @@ jobs:
- name: Clean up local files
if: always()
run: |
rm -rf ./temp_backup
rm -rf ./temp_backup
Loading