Skip to content

Commit

Permalink
[mod] node 버전 변경 및 배포 환경에 따른 빌드 명령 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hyejungg authored Jan 30, 2022
1 parent 4157bfa commit 505b35d
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,26 @@ on:
branches:
- main
- dev

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x] # 개발환경과 동일하게 맞춤

steps:
#CI
# 브랜치에 checkout해 코드를 가져온다
- name: Checkout source code. # node 버전을 확인한다.
- name: Checkout source code.
uses: actions/checkout@v2
- name: Check Node v
run: node -v

# node 설치 및 버전 확인한다.
- name: Node.js ${{ matrix.node-version }} install
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Check Npm -v
run: npm -v
# 캐시 작업 추가(이전에 dependency를 설치했다면 캐시를 이용하도록
# - name: Cache node modules
# id: node-cache
Expand All @@ -32,15 +42,32 @@ jobs:
# ${{ runner.os }}-build-
# ${{ runner.os }}-
# 직업폴더를 설정 한 수 의존 파일을 설치한다.
- name: Install Dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
working-directory: .
# --frozen-lockfile는 install 시 yarn.lock파일 생성 X, 업데이트 필요 시 실패
run: yarn install --frozen-lockfile
# Build한다
- name: Build # Fastify Build and Start
working-directory: .
run: yarn run build
# - name: Install Dependencies
# if: steps.node-cache.outputs.cache-hit != 'true'
# working-directory: .
# # --frozen-lockfile는 install 시 yarn.lock파일 생성 X, 업데이트 필요 시 실패
# run: yarn install --frozen-lockfile
# # Build한다
# - name: Build # Fastify Build and Start
# working-directory: .
# run: yarn run build

# npm ci를 통해 npm install 진행
- name: npm CI
run: npm ci

#lint 통과 확인
- name: check ESLint
run: npm run lint

# CI 통과 시 build하여 server.js 파일 생성
- name: run build (dev)
if: ${{ github.ref == 'refs/heads/dev' }}
run: npm run build --if-present

- name: run build (main)
if: ${{ github.ref == 'refs/heads/main' }}
run: npm run build:production --if-present

#CD
# build 파일을 ec2에 올리기
Expand Down

0 comments on commit 505b35d

Please sign in to comment.