-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (33 loc) · 1.12 KB
/
backend-deploy.yml
File metadata and controls
37 lines (33 loc) · 1.12 KB
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
35
36
37
name: Deploy to AWS EC2
on:
workflow_run:
workflows: [Build CI]
types:
- completed
jobs:
deploy:
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: Print Trigger Info
run: |
echo "Workflow event: ${{ github.event.workflow_run.event }}"
echo "Head branch: ${{ github.event.workflow_run.head_branch }}"
- 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