본문으로 바로가기

./package.json

"build": "gatsby build --prefix-paths",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "gatsby develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"deploy": "npm run build && gh-pages -d public -b master",
"pre-commit": "lint-staged",
"prepare": "husky install"

 

.github/workflows/main.yml

name: typed-blog-deploy

on:
  push:
    branches: [master]

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      # https://github.com/marketplace/actions/checkout
      - name: 🧑🏻‍💻 checkout source code
        uses: actions/checkout@v2.3.4

      # https://github.com/marketplace/actions/setup-node-js-environment
      - name: 😎 Setup Node
        uses: actions/setup-node@v2.1.2
        with:
          node-version: '12.x'

      # https://github.com/marketplace/actions/yarn-install-cache
      - name: 🚀 yarn cache
        uses: c-hive/gha-yarn-cache@v2

      - name: 🕸 install dependencies on ubuntu
        run: yarn install

      - name: 🏢 build
        run: yarn build

      - name: 👊🏻 deploy
        uses: Cecilapp/GitHub-Pages-deploy@v3
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          email: hello@business-canvas.com
          build_dir: public
          branch: master

 

나중에 master가 더러워진다고 deploy branch를 파고, github 설정에서도 deploy branch를 바라보도록 수정했다.

위 yml 에서는 master를 모두 deploy로 고치면 된다.

'React, Next, Redux > 🍹 gatsby' 카테고리의 다른 글

회사에서 기술 블로그 운영하기  (0) 2021.11.03

darren, dev blog
블로그 이미지 DarrenKwonDev 님의 블로그
VISITOR 오늘 / 전체