-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (25 loc) · 859 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
name: EC2 Deploy
on:
push:
branches: master
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy in EC2
env:
PRIVATE_KEY: ${{ secrets.AWS_EC2_PRIVATE_KEY }}
HOSTNAME : ${{ secrets.AWS_EC2_HOSTNAME }}
USER: ${{ secrets.AWS_EC2_USER }}
run: |
echo "$PRIVATE_KEY" > private_key.pem && chmod 600 private_key.pem
ssh -o StrictHostKeyChecking=no -i private_key.pem ${USER}@${HOSTNAME} '
#Now we have got the access of EC2 and we will start the deploy .
cd ~/hourglass/backend &&
git checkout master &&
git pull origin master &&
source bin/activate &&
pip install -r requirements.txt &&
pm2 restart hourglass-flask --update-env
'