Merge remote-tracking branch 'origin/dev' into dev #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to GCP VM | |
| on: | |
| push: | |
| branches: | |
| - dev # main 브랜치에 푸시될 때 실행 | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. GitHub 코드 체크아웃 | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| # 2. Node.js 환경 설정 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| # 3. 의존성 설치 및 빌드 | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npm run build | |
| # 4. GCP VM에 SSH로 배포 | |
| - name: Deploy to GCP VM | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.VM_HOST }} | |
| username: ${{ secrets.VM_USER }} | |
| key: ${{ secrets.VM_SSH_KEY }} | |
| port: 22 | |
| script: | | |
| cd /var/www/cercat | |
| git pull origin main | |
| npm install | |
| npm run build | |
| pm2 restart cercat |