Merge pull request #21 from SV-Winter-BootCamp-Team-C/fix/#20 #6
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: Node.js CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DB_HOST: ${{ secrets.DB_HOST }} | |
DB_USERNAME: ${{ secrets.DB_USERNAME }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_DATABASE: ${{ secrets.DB_DATABASE }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
NODE_DOCKER_PORT: ${{ secrets.NODE_DOCKER_PORT }} | |
GMAIL_OAUTH_USER: ${{ secrets.GMAIL_OAUTH_USER }} | |
GMAIL_OAUTH_CLIENT_ID: ${{ secrets.GMAIL_OAUTH_CLIENT_ID }} | |
GMAIL_OAUTH_CLIENT_SECRET: ${{ secrets.GMAIL_OAUTH_CLIENT_SECRET }} | |
GMAIL_OAUTH_REFRESH_TOKEN: ${{ secrets.GMAIL_OAUTH_REFRESH_TOKEN }} | |
AWS_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_KEY }} | |
AWS_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }} | |
AWS_S3_REGION: ${{ secrets.AWS_S3_REGION }} | |
AWS_BUCKET: ${{ secrets.AWS_BUCKET }} | |
PEXELS_API_KEY: ${{ secrets.PEXELS_API_KEY }} | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# 백엔드 의존성 설치 | |
- 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 frontend | |
run: | | |
cd frontend | |
npm run lint | |
- name: Install AWS CLI | |
run: | | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install | |
# 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 ./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 }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }} |