Skip to content

Commit

Permalink
fix: ci/cd 워크플로우 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
PMtHk committed Nov 13, 2024
1 parent 59f5991 commit b620b14
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 64 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CD

on:
push:
branches:
- dev

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install pnpm
run: npm install pnpm -g

- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies and build
run: |
pnpm install
turbo build
- name: Deploy to Ubuntu server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
# NVM setup
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Install pnpm pm2
npm install -g pnpm
npm install -g pm2
# move to directory and pull latest changes
cd ../var/www/harmony
git pull origin main
# Install dependencies
pnpm install
# Add envs
echo "${{ secrets.SERVER_ENV }}" >> apps/server/.env
echo "${{ secrets.CLIENT_ENV }}" >> apps/client/.env
# Build
pnpm build
# Restart pm2
pm2 restart apps/server/ecosystem.config.js --env production || pm2 start apps/server/ecosystem.config.js --env production
echo "Deployment Success"
32 changes: 32 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
pull_request:
branches: [ dev ]

jobs:
ci:
name: CI
runs-on: ubuntu-latest

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
64 changes: 0 additions & 64 deletions .github/workflows/ci-cd.yml

This file was deleted.

0 comments on commit b620b14

Please sign in to comment.