Skip to content

Merge pull request #54 from InserToken/feat/37-indicator/Eunseo3 #17

Merge pull request #54 from InserToken/feat/37-indicator/Eunseo3

Merge pull request #54 from InserToken/feat/37-indicator/Eunseo3 #17

Workflow file for this run

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.SERVER_PATH }}
- name: Build & Restart on EC2
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
cd ${{ secrets.SERVER_PATH }}
npm install --production
pm2 restart UpAndDown-Server || pm2 start npm --name UpAndDown-Server -- run start
EOF