1. 루트 디렉토리 안에 .github 폴더, 그 안에 workflows 폴더를 만들고 .github/workflows 폴더 내에 deploy.yml 파일을 생성해줍니다.

Untitled

  1. deploy.yml 파일 내용을 다음과 같이 입력해줍니다.
name: Deploy Phaser Application

on:
  workflow_dispatch:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Use Nodejs ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: "16"
          cache: "npm"
      - name: Make .env
        uses: SpicyPizza/[email protected]
        with:
          envkey_DEBUG: false
      - run: npm ci
      - run: npm run build
      - name: deploy to gh-pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist
  1. add, commit, push를 해줍니다.
git add .
git commit -m "Add auto deploy"
git push
  1. GitHub repository에 들어가 진행 상황을 확인합니다.

Untitled

위와 같이 초록색 체크 표시가 뜨면 잘 배포된 것입니다. 노란색 동그라미는 진행중, 빨간색 X 표시는 실패한 상태를 나타냅니다. Details를 눌러 빌드 및 배포 상황을 자세히 살펴볼 수 있습니다. 실패한 경우 인프런으로 질문을 남겨주시기 바랍니다.

  1. 배포가 완료되면 https://[GitHub 아이디].github.io/[Repository 이름]/ 에서 확인할 수 있습니다!

Untitled