diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e987469..8b63172 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,19 +32,47 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v3 # 버전을 최신으로 업데이트 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 # 버전을 최신으로 업데이트 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Install Dependencies - run: npm install - - name: Build - run: npm run build --if-present + # 백엔드 의존성 설치 + - name: Install backend dependencies + run: | + cd backend + npm install + + # 백엔드 빌드 + - name: Build backend + run: | + cd backend + npm run build --if-present + + # 백엔드 린트 + - name: Lint backend + run: | + cd backend + npm run lint + + # 프론트엔드 의존성 설치 + - name: Install frontend dependencies + run: | + cd frontend + npm install + + # 프론트엔드 빌드 + - name: Build frontend + run: | + cd frontend + npm run build --if-present - - name: Lint - run: npm run lint + # 프론트엔드 린트 + - name: Lint frontend + run: | + cd frontend + npm run lint - name: Install AWS CLI run: | @@ -52,10 +80,21 @@ jobs: unzip awscliv2.zip sudo ./aws/install - - name: Upload to AWS S3 - if: success() # 이전 단계가 성공했을 경우에만 실행 + # AWS S3로 백엔드 빌드 파일 업로드 + - name: Upload backend to AWS S3 + if: success() + run: | + aws s3 cp ./backend/build s3://${{ secrets.AWS_BUCKET }}/backend/ --recursive + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }} + + # AWS S3로 프론트엔드 빌드 파일 업로드 + - name: Upload frontend to AWS S3 + if: success() run: | - aws s3 cp ./build s3://${{ secrets.AWS_BUCKET }}/ --recursive + aws s3 cp ./frontend/build s3://${{ secrets.AWS_BUCKET }}/frontend/ --recursive env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_KEY }}