Skip to content

Merge pull request #181 from innovationacademy-kr/feat-#177 #262

Merge pull request #181 from innovationacademy-kr/feat-#177

Merge pull request #181 from innovationacademy-kr/feat-#177 #262

Workflow file for this run

name: CI/CD
on: [push]
jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: 타임존 설정
uses: szenius/[email protected]
with:
timezoneLinux: "Asia/Seoul"
- name: 체크아웃
uses: actions/checkout@v3
- name: Node.js 16.x Version
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: 종속 모듈들 캐싱
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/node_modules
key: npm-packages-${{ hashFiles('**/package-lock.json') }}
id: cache
- name: 종속 모듈들 설치
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
- name: lint 체크
run: npm run lint
- name: 빌드 체크
run: npm run build
- name: 단위 테스트 체크
run: npm run test
- name: 통합 테스트 체크
run: npm run test:e2e
CD-develop:
name: deploy-develop
runs-on: ubuntu-latest
needs: CI
if: ${{ github.ref == 'refs/heads/develop' }}
steps:
- name: 리모트 쉘 접속
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_DEVELOP_HOST }}
username: ${{ secrets.EC2_DEVELOP_USER }}
key: ${{ secrets.EC2_DEVELOP_SSH_KEY }}
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
echo "해당 리포지토리로 이동"
cd $HOME/24-not-enough
echo "리포지토리 pull"
git pull origin develop
echo "앱 빌드"
npm install
npm run build
echo "앱 배포 (reload)"
pm2 reload 24-not-enough
CD-main:
name: deploy-main
runs-on: ubuntu-latest
needs: CI
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: 리모트 쉘 접속
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_DEPLOY_HOST }}
username: ${{ secrets.EC2_DEPLOY_USER }}
key: ${{ secrets.EC2_DEPLOY_SSH_KEY }}
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
echo "해당 리포지토리로 이동"
cd $HOME/24-not-enough
echo "리포지토리 pull"
git pull origin main
echo "앱 빌드"
npm install
npm run build
echo "앱 배포 (reload)"
pm2 reload 24-not-enough