-
Notifications
You must be signed in to change notification settings - Fork 1
29 lines (26 loc) · 1.12 KB
/
main.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
name: BalanceCat
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: SSH into EC2 instance and deploy services
run: |
echo "${{ secrets.EC2_PRIVATE_KEY }}" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }} '
cd /home/ubuntu/BalanceCat &&
git pull origin develop &&
echo "${{ secrets.FRONTEND_ENV_FILE }}" > frontend/.env &&
echo "${{ secrets.BACKEND_ENV_FILE }}" > backend/.env &&
echo "${{ secrets.COMBINED_CRT }}" > private/combined.crt &&
echo "${{ secrets.PRIVATE_KEY }}" > private/private.key &&
sudo docker-compose down &&
sudo docker-compose up --build -d &&
yes | sudo docker system prune &&
yes | sudo docker volume prune
'