CI/CD Pipeline #38
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- apps/backend/** | |
- packages/** | |
- '/*' | |
- '/.github/workflows/deploy.yml' | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Deploy to VPS | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: '.,!node_modules' | |
target: '~/caho' | |
- name: Install dependencies | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
cd ~/caho | |
pnpm i --frozen-lockfile | |
- name: Build application on VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
cd ~/caho | |
pnpm build --filter=@caho/backend | |
- name: Restart application on VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
pm2 restart caho |