Skip to content

Commit d4e0a3a

Browse files
authored
Backend/oxomi/cicd pipeline (#15)
## 📝작업 내용 - GitHub Actions 워크플로우(deploy.yml) 추가 - main 브랜치에 푸시될 때 자동으로 EC2 서버에 배포되도록 설정
1 parent 37c06b6 commit d4e0a3a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Deploy to EC2
2+
3+
on:
4+
push:
5+
branches: [ "main" ] # main 브랜치 푸시 시 실행
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
- name: Setup SSH
16+
uses: webfactory/[email protected]
17+
with:
18+
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}
19+
20+
- name: Deploy to EC2
21+
run: |
22+
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
23+
cd ~/ComTogether/backend
24+
git pull
25+
docker-compose down
26+
docker-compose up --build -d
27+
EOF

0 commit comments

Comments
 (0)