Skip to content

Commit

Permalink
Merge pull request #14 from Cleanwalk-org-QNSCNT/main
Browse files Browse the repository at this point in the history
add rollback job
  • Loading branch information
ArthurFrin authored Jul 27, 2024
2 parents 0238285 + fe90d2a commit 93e604a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ jobs:
with:
ssh-private-key: ${{ secrets.SECRET_KEY }} # Utilisation de la clé SSH

- name: Backup current state
env:
VPS_IP: ${{ secrets.VPS_IP }}
run: |
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$VPS_IP '
rm -rf /home/cleanwalk-backup &&
cp -r /home/cleanwalk-org-v2 /home/cleanwalk-backup
'
- name: Deploy to VPS
env:
VPS_IP: ${{ secrets.VPS_IP }}
Expand All @@ -28,3 +37,22 @@ jobs:
docker compose -f docker-compose.prod.yml down &&
docker compose -f docker-compose.prod.yml up -d --build
'
- name: Cleanup backup
if: success()
env:
VPS_IP: ${{ secrets.VPS_IP }}
run: |
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$VPS_IP '
rm -rf /home/cleanwalk-backup
'
- name: Rollback (if needed)
if: failure()
env:
VPS_IP: ${{ secrets.VPS_IP }}
run: |
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$VPS_IP '
cd /home/cleanwalk-backup &&
docker compose -f docker-compose.prod.yml up -d --build
'

0 comments on commit 93e604a

Please sign in to comment.