Automate Blog Deployment with Travis CI

How I used Travis CI to auto-build and deploy my Hexo blog whenever the source branch is pushed.

Jul 4, 2017 · 1 min read · 108 Words · -Views -Comments · Programming
CI/CD 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

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.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover