Use SinBlog with Travis CI
This tutorial talks about how to use SinBlog with Travis CI to deploy your blog site automatically.
What is Travis CI
CI is the abbreviation of Continuous Integration.
Ok, It's a little complicated......
Travis CI is a hosted continuous integration service used to build and test software projects hosted at GitHub. Travis CI provides various paid plan for private projects, and a free plan for open source. TravisPro provides custom deployments of a proprietary version on the customer's own hardware.
In short, Travis CI is a tool that can run automation scripts in your GitHub repository.
Check their website for more information: https://travis-ci.com.
It doesn't matter if you dono't understand what Travic CI do, Just follow this tutorial.
A GitHub Repository
First, you should have a GitHub account. If you don't, click here to register one.
Create a repository to store your blogs.
If you don't know how to use Git or GitHub, may be you are not very appropriate for this tutorial......
Open travis-ci.com in your broswer, click the big green button to sign up.
Follow the sign up guide and sign in at travis-ci.com.
Click the green Activate button, and select the repositories you want to use with Travis CI.
The official document is really explicit: Travis CI Tutorial
In order to let Travis CI to control your GitHub repositroy, you need to generate a GitHub Token for Travis CI.
Follow this document: Creating a personal access token for the command line.
Select scopes as below:
Now you have a GitHub Token in your clipboard. Be careful don't lose it because you will not be able to see it again.
Set GitHub Token to Environment Value
Open the Dashboard at travis-ci.com, choose your target repositroy.
More options ->
Settings, scroll down, see the Environment Variables part.
Paste your GitHub Token in VALUE input, and set NAME to
GITHUB_TOKEN, then click the Add button in the right.
Do not turn the DISPLAY VALUE IN BUILD LOG option on.
.travis.yml to your repo
Create a file named
.travis.yml in your blog directory, and copy this configurations:
language: node_js node_js: - node install: - npm install -g sinblog script: - sinblog build deploy: provider: pages local_dir: dist skip_cleanup: true github_token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable keep_history: false on: branch: master
.travis.yml to git control, and push it to GitHub.
sinblog.config.yml file. See SinBlog Docs for more details.
These are all steps you need to do.
How to publish a blog?
- Write a Markdown blog file, for example,
git add hello-world.md
git commit -m 'blog'
Then Travis CI will generate blog site, and push it to GitHub Pages. All is automacial.
For example, if your GitHub repository URL is
https://github.com/USER_NAME/blog/, you can visite your blog site at