Automate Blog Deployment with Travis CI

Automate Blog Deployment with Travis CI

7月 4, 2017 · 1 分钟阅读时长 · 108 字 · -阅读 -评论

Travis CI is a hosted, distributed continuous integration service for GitHub projects.

Background

My blog lives on GitHub. The master branch holds the generated static site, while source stores the Hexo project. Before automation, publishing a new post meant:

# 1. Stage changes
$ git add .
# 2. Commit
$ git commit -m 'update'
# 3. Push to remote
$ git push
# 4. Generate + deploy static site
$ hexo g -d

After CI

Now any push to the source branch triggers Travis CI to build and deploy to the static-site branch automatically. I only write posts and push—the deployment step (4) is handled by CI.

Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源