-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 885 Bytes
/
deploy.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
name: Deploy
on:
push:
branches:
- main
jobs:
Production:
name: Deploy to DigitalOcean
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v3
- name: Build & Deploy
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{secrets.SSH_HOST}}
USER_NAME: ${{secrets.USER_NAME}}
run: |
echo "Deploying to EC2"
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${{ secrets.USER_NAME }}@${{ secrets.SSH_HOST }} '
cd /root/course-gpt &&
git reset --hard &&
git checkout main &&
git pull origin main &&
docker-compose down &&
docker-compose rm -fsv &&
docker-compose up --build -d
'