I use two separate repositories for the source and the built website. One is
userpages (source of the website) and the other is siongui.github.io
(built website).
Build Website
First add .travis.yml in the root of your source repo. My
configuration is as follows:
language: python
python:
- '2.7'
branches:
only:
- master
addons:
apt:
packages:
- language-pack-en
- language-pack-zh-hant
- language-pack-th
install:
- pip install -r requirements.txt
- make download
script:
- make publish
My website support threes languages (English, Traditional Chinese, Thai), and I
need three locales (en_US.UTF8, zh_TW.UTF-8, th_TH.UTF-8) to build each
subsites. That's why three language-packs are installed.
Now Travis CI officially support deploy your static files to GitHub Pages after
a successful build.
First save your personal access token in repository settings.
For User Pages, the following is sample config:
deploy:
provider: pages
repo: siongui/siongui.github.io
target_branch: master
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: output
on:
branch: master
For Project Pages, the following is sample config:
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: output
on:
branch: master
References: