본문 바로가기
web

github actions

by java개발자 2021. 4. 27.
Treating warnings as errors because process.env.CI = true
Most CI servers set it automatically.

github actions에서

git push 하면, 자동 빌드 및 S3 배포를 설정하는 중에 build 에러

warning이 하나라도 있으면 error로 간주해서 build가 실패한다.ㅠ

 

보통 lint warning...

뭐 CI = npm run build... ? 이렇게 하라지만...

warning도 고치자.

lint 반영하기 싫으면 rules에서 off~

 

============

스크립트 작성시 주의 (main / stage)

 

1. name은 꼭 다르게 하자. 안그럼 이렇게 나온다.ㅠ

2. secrets는 프로젝트 settings에서 하면 되고, 혹시 main/stage 별로 key가 다르다면, 이름은 구별해서~

# This is a basic workflow to help you get started with Actions

name: Deploy Production

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v1
        with:
          node-version: 12

      - name: Cache node modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          # npm cache files are stored in `~/.npm` on Linux/macOS
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-

      - name: npm install
        run: npm install

      - name: build
        run: npm run build

      # Runs a set of commands using the runners shell
      - name: deploy
        env:
          AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
        run: |
          aws s3 cp \
            --recursive \
            --region ap-northeast-2 \
            build s3://버킷이름

'web' 카테고리의 다른 글

브라우저 탭 2개 스크롤 동기화 (웨일, 크롬 브라우저)  (2) 2022.10.06
graphql 기본 문법 정리  (0) 2020.07.03
react.js  (0) 2020.07.03
vue.js vs react.js  (0) 2020.06.24
[spring을 spring 답게] spring 세팅  (0) 2020.03.27