Burt.K

Awesome Discovery

Github Actions로 Hugo 배포하기

Posted at — Aug 4, 2021

travis-ci.org를 사용해 Hugo를 배포해 오다가 travis-ci.org가 유료로 변경되어 Github actions로 배포 방법을 변경했다. utterances 로 코멘트를 관리하기 때문에 코멘트 이슈를 관리하기 위해 레포를 2개로 분리하여 사용하고 있다.

peaceiris/actions-hugo@v2를 사용해 쉽게 배포 워크플로우를 작성할 수 있었다.

다른 레포에 접근하기 위해서 레포에 접근하기 위한 토큰을 만들어 디플로이를 하면 된다.

...
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: ${{ github.ref == 'refs/heads/master' }}
        with:
          personal_token: ${{ secrets.PERSONAL_TOKEN }}
          external_repository: skyfe79/skyfe79.github.io
          publish_branch: master
          publish_dir: ./public
          cname: blog.burt.pe.kr

워크플로우 전체 내용은 여기에서 확인할 수 있다.