ngnix #4
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 EC2 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "backend/**" | |
| concurrency: | |
| group: deploy-production | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy via SSH | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: 52.66.7.244 | |
| username: ubuntu | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| command_timeout: 5m | |
| script: | | |
| set -e | |
| cd ~/softwareProject | |
| git pull origin main | |
| cd backend | |
| npm install --omit=dev | |
| pm2 restart backend | |
| pm2 save |