TravisCI for Hugo Build
Here's the TravisCI yml file I used while this site was still with TravisCI.
It gets the hugo specific version, build the site and commit + push to gh-pages.
Just adapt it to your situation and enjoy!
1language: python
2
3env:
4 global:
5 - USER="icasimpan"
6 - EMAIL="deploy@travis-ci.com"
7 - DEPLOYMENT_USER="traviscibot"
8 - REPO="quicktasks"
9 - BUILD_DIR="public"
10 - GH_REPO="github.com/${USER}/${REPO}.git"
11 - HUGO_VERSION="0.96.0"
12 - HUGO_INSTALLER_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb"
13 - GH_PUBLISH_BRANCH='gh-pages'
14
15## Force commit to 'gh-pages' the built hugo site
16after_success:
17 - MESSAGE='Auto-built and commit via Travis CI.'
18 - ls -l
19 - mv ${BUILD_DIR} ~/ || exit 1
20 - cd ~/${BUILD_DIR}
21 - git init
22 - git add .
23 - git config user.email ${EMAIL}
24 - git config user.name ${DEPLOYMENT_USER}
25 - git commit -m "${MESSAGE}"
26 - git checkout -b ${GH_PUBLISH_BRANCH}
27 - git push "https://${GITHUB_TOKEN}@${GH_REPO}" ${GH_PUBLISH_BRANCH} -f
28
29install:
30 - wget ${HUGO_INSTALLER_URL}
31 - sudo dpkg -i hugo*.deb
32 - pip install Pygments
33
34script:
35 - hugo -s ./