Merge pull request #20 from ccaaffee/fix/userpath #11
Workflow file for this run
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 Cafe-search Backend to Server | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Add SSH Key to Agent | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| eval "$(ssh-agent -s)" | |
| ssh-add ~/.ssh/id_rsa | |
| ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy and Restart on EC2 | |
| run: | | |
| ssh -i ~/.ssh/id_rsa ubuntu@${{ secrets.HOST }} << 'EOF' | |
| cd ~/backend | |
| git pull origin main | |
| npm ci | |
| npx prisma migrate deploy | |
| npx prisma generate | |
| npm run build | |
| pm2 reload cafe_backend | |
| EOF |