-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (31 loc) · 1.03 KB
/
deploy.yml
File metadata and controls
37 lines (31 loc) · 1.03 KB
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
name: 🚀 Auto Deploy to EC2
# develop 브랜치에 push 될 때마다 실행
on:
push:
branches:
- develop
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Sync code to EC2
run: |
rsync -e "ssh -o StrictHostKeyChecking=no" -avz --delete \
--exclude='.git*' \
--exclude='node_modules' \
--exclude='.env' \
./ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.CLIENT_PATH }}
- name: Build & Restart on EC2
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
cd ${{ secrets.CLIENT_PATH }}
npm install
npm run build
pm2 restart UpAndDown-Client || pm2 start npm --name UpAndDown-Client -- run start
EOF