-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (45 loc) · 1.21 KB
/
cicd.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
38
39
40
41
42
43
44
45
46
47
48
name: CI/CD
on:
push:
branches:
- dev
release:
types:
- created
jobs:
CD-dev:
name: develop
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
# needs: CI
steps:
- name: Deploy to Dev EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_DEV_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd 42Stat-Backend
git pull origin dev
git submodule update --init --recursive
docker-compose down -v
docker-compose -f docker-compose.dev.yml up -d
CD-prod:
name: production
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
# needs: CI
steps:
- name: Deploy to Prod EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_PROD_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd 42Stat-Backend
git pull origin main
git submodule update --init --recursive
docker-compose down -v
docker-compose -f docker-compose.prod.yml up -d