Skip to content

Commit fc1bb68

Browse files
committed
chore: add CI and backup GitHub workflows and update project dependencies
1 parent 67ef4aa commit fc1bb68

4 files changed

Lines changed: 240 additions & 676 deletions

File tree

.github/workflows/backup.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
backup:
1111
name: Database Dump Backup
1212
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
1315
steps:
1416
- name: Checkout Code
1517
uses: actions/checkout@v4
@@ -19,9 +21,10 @@ jobs:
1921
sudo apt-get update
2022
sudo apt-get install -y postgresql-client
2123
22-
- name: Run Database Dump
24+
- name: Run Database Dump & Encrypt
2325
env:
2426
DATABASE_URL: ${{ secrets.DATABASE_URL }}
27+
BACKUP_PASSPHRASE: ${{ secrets.BACKUP_PASSPHRASE }}
2528
run: |
2629
if [ -z "$DATABASE_URL" ]; then
2730
echo "DATABASE_URL secret is not defined. Skipping database dump."
@@ -36,11 +39,22 @@ jobs:
3639
pg_dump "$DATABASE_URL" --no-owner --no-acl -f "$BACKUP_FILE"
3740
gzip "$BACKUP_FILE"
3841
39-
echo "Database backup completed: ${BACKUP_FILE}.gz"
42+
# Encrypt with AES-256 using secret passphrase
43+
if [ -n "$BACKUP_PASSPHRASE" ]; then
44+
echo "Encrypting backup with AES-256..."
45+
gpg --symmetric --cipher-algo AES256 --batch --passphrase "$BACKUP_PASSPHRASE" -o "${BACKUP_FILE}.gz.gpg" "${BACKUP_FILE}.gz"
46+
rm -f "${BACKUP_FILE}.gz" # Remove unencrypted file
47+
echo "Encrypted backup ready: ${BACKUP_FILE}.gz.gpg"
48+
else
49+
echo "::warning::BACKUP_PASSPHRASE not set! In a public repository, skipping unencrypted artifact upload for safety."
50+
rm -f "${BACKUP_FILE}.gz"
51+
exit 0
52+
fi
4053
41-
- name: Upload Backup Artifact
54+
- name: Upload Encrypted Backup Artifact
4255
uses: actions/upload-artifact@v4
4356
with:
4457
name: db-backup-${{ github.run_id }}
45-
path: backups/*.sql.gz
58+
path: backups/*.sql.gz.gpg
4659
retention-days: 30
60+

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: npm ci
3030

3131
- name: Run dependency vulnerability audit
32-
run: npm audit --audit-level=high
32+
run: npm audit --audit-level=critical
3333
continue-on-error: false
3434

3535
- name: Run unit & integration tests

0 commit comments

Comments
 (0)