Skip to content

Commit e23240d

Browse files
committed
change dispatch
1 parent 7d577a7 commit e23240d

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

.github/workflows/pg_dump.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
name: Backup PostgreSQL Database
22

33
on:
4-
schedule:
5-
- cron: "0 19 * * *"
6-
pull_request:
7-
branches:
8-
- main
9-
push:
10-
branches:
11-
- main
4+
repository_dispatch:
5+
types: [backup-database]
126

137
jobs:
148
backup:
@@ -25,8 +19,7 @@ jobs:
2519
sudo apt-get update
2620
2721
- name: Install PostgreSQL Client
28-
run: |
29-
sudo apt-get install -y postgresql-client-15
22+
run: sudo apt-get install -y postgresql-client-15
3023

3124
- name: Backup database
3225
run: |
@@ -38,8 +31,7 @@ jobs:
3831
env:
3932
PGPASSWORD: ${{ secrets.PG_PASSWORD }}
4033

41-
- name: Upload backup to GitHub
42-
uses: actions/upload-artifact@v3
43-
with:
44-
name: pg-dump-backup
45-
path: backup.sql
34+
- name: Copy backup to local
35+
run: |
36+
mkdir -p ~/db_backups
37+
cp backup.sql ~/db_backups/backup_$(date +'%Y%m%d%H%M%S').sql

0 commit comments

Comments
 (0)