Github Actions로 gh-pages 자동 배포하기

sunone-lee·2022년 9월 7일
0

Github

목록 보기
1/5

1. 폴더 및 파일 만들기

.github\workflows\workflows.yml

2. workflows.yml

name: Github Pages Deploy
on:
  push:
    branches:
      - "master"
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Install and build
        run: npm install && npm run build
        env:
          CI: "" # 경고를 에러로 보지 않게 함
      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@4.1.1
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: build # The folder the action should deploy.

※ 경고가 있을시 에러로 판단해서 빌드가 되지 않은 오류가 발생 하여서 아래 코드 추가하였더니 해결

env:
          CI: "" # 경고를 에러로 보지 않게 함

↓ 이렇게 나오면 성공!!!

확인가능한 github
https://github.com/leehyemimi/react-voca/tree/gh-pages

참고한 사이트
https://velog.io/@kdeun1/Github-Actions%EB%A1%9C-gh-pages-%EC%9E%90%EB%8F%99-%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0

https://www.youtube.com/watch?v=5I37iVCDUTU

0개의 댓글