브리더 모아보기 #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install --force | |
- name: .env setting | |
run: | | |
echo "REACT_APP_API_URL=$REACT_APP_API_URL" >> .env | |
env: | |
REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }} | |
- name: Test | |
run: npm run test | |
- name: Build | |
run: npm run build | |
# 기존 설정 파일 삭제 | |
- run: rm /etc/nginx/conf.d/default.conf | |
# checkout 하며 받아온 설정파일 이동 | |
- run: mv default.conf /etc/nginx/conf.d/ | |
# 변경사항 적용을 위한 nginx 재실행 | |
- run: service nginx reload | |
- name: Notify Deploy Job Done | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
author_name: frontend | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | |
if_mention: failure,cancelled | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: always() |