-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (34 loc) · 899 Bytes
/
cd.yml
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: CD
on:
workflow_run:
workflows:
- ContinuousIntegration
types:
- completed
branches:
- main
- development
pull_request:
types:
- closed
branches:
- main
- development
jobs:
deploy:
if: (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
|| github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: SSH into EC2 and deploy
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd /home/ec2-user
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/readup-sever
docker compose down
docker compose up -d
docker system prune -f