-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (29 loc) · 955 Bytes
/
deploy-backend.yml
File metadata and controls
34 lines (29 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Deploy to AWS EC2
on:
workflow_run:
workflows: [Run CI]
types:
- completed
jobs:
deploy-backend:
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main' &&
github.event.workflow_run.event == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Deploy on EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd feed-forward || exit 1
git pull origin main
docker-compose -f docker-compose.yml -f docker-compose.prod.yml down
docker rmi $(docker images -q)
docker system prune -a
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build