Skip to content

CI/CD Pipeline

CI/CD Pipeline #38

Workflow file for this run

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