Back to Blog

Hugo와 travis 연동하기

블로그에 CI 적용할 때 go get 방식을 썼더니 시간도 오래 걸리고 최근 에러가 생겼다. 그래서 hugo의 바이너리 버전을 다운로드 받아쓰도록 해봤다.

./scripts/install-hugo.sh:

#!/bin/bash set -eu curl -L -o /tmp/hugo.tar.gz 'https://github.com/gohugoio/hugo/releases/download/v0.55.0/hugo_0.55.0_Linux-64bit.tar.gz' curDir=$(pwd) cd $HOME/bin && tar -xvzf /tmp/hugo.tar.gz && cd $curDir

travis.yml:

language: shell install: - export PATH=$PATH:$HOME/bin - bash ./scripts/install-hugo.sh script: - hugo deploy: local_dir: public # hugo 기본값 repo: kdy1/kdy1.github.io # 배포될 저장소 target_branch: master # kdy1/blog 같은 레포지토리를 쓴다면 gh-pages여야함 provider: pages skip_cleanup: true # 중요 github_token: $GITHUB_TOKEN email: kdy1@outlook.kr name: "강동윤" on: branch: master

GITHUB_TOKEN 발급 받을 땐 https://ironpark.github.io/2017/12/17/hugo-site-deploy-use-travis-ci/#github-token-%EB%B0%9C%EA%B8%89 에 나온대로 하면 된다.

결과

푸시 이후 업데이트까지 40초 걸린다.


2019/04/12: Hugo 버전 업데이트