Fix : 의존성 설치 CI 속도 개선 #32
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: MajorIn | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code. # 레포지토리 체크아웃 | |
uses: actions/checkout@v4 | |
- name: Cache node modules # node modules 캐싱 | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-build- | |
${{ runner.OS }}- | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 # 최신 버전으로 업데이트 | |
with: | |
node-version: "18.20.4" # 사용 중인 Node.js 버전 설정 | |
- name: .env setting | |
run: | | |
echo "VITE_APP_SERVER_URL=${{ secrets.VITE_APP_SERVER_URL }}" >> .env | |
echo "VITE_APP_AI_URL=${{ secrets.VITE_APP_AI_URL }}" >> .env | |
- name: Install Dependencies # 의존 파일 설치 | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Update Browserslist DB | |
run: npx update-browserslist-db@latest | |
- name: Build # React Build | |
env: | |
CI: false # 경고를 오류로 처리하지 않도록 설정 | |
run: npm run build | |
- name: Deploy # S3에 배포하기 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
aws s3 sync \ | |
--delete \ | |
--region ap-northeast-2 \ | |
dist/ s3://majorin |