Skip to content

chore: ci 생성

chore: ci 생성 #1

Workflow file for this run

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: [14.x]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build --if-present
- name: Lint
run: 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
- name: Upload to AWS S3
if: success() # 이전 단계가 성공했을 경우에만 실행
run: |
aws s3 cp ./build s3://${{ secrets.AWS_BUCKET }}/ --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 }}