Skip to content

feat: cd workflow 작성 #3

feat: cd workflow 작성

feat: cd workflow 작성 #3

Workflow file for this run

name: CI/CD Pipeline
on:
pull_request:
branches: [ dev ]
push:
branches: [ dev ]
jobs:
ci:
name: CI
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: '9'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
cd:
name: CD
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: connect to server via ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /var/www/harmony
git pull
pnpm install
pnpm build
pm2 start apps/server/dist/main.js harmony-api