LOVIN YOU

There is no Y in { happiness }, It's an I

Automatically deploy your Ink blog to GitHub pages wiht Travis CI

shery Travis CIGitHub Pages

InkPaper & Travis CI

Introduction

InkPaper is an static blog generator developed by Golang, No dependencies, Cross platform, Easy use, Fast build, Elegant theme. New to InkPaper? With Travis CI can solve the problem of automatic build and deployment, so that we can focus more on writing.

What is Travis CI?

Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted at GitHub. This means that you’d better host your static blog on GitHub Pages. When Travis CI has been activated for GitHub Pages repository, GitHub will notify it whenever new commits are pushed to that repository. It can also be configured to only run for specific branches, or branches whose names match a specific pattern. Travis CI will then check out the relevant branch and run the commands specified in .travis.yml, which usually build the software and run any automated tests, in this post we will use Travis CI to run ink build and push to GitHub Pages branch. When that process has completed, Travis notifies the developer(s) in the way it has been configured to do so.

Configuration

Before starting, make sure that your static blog repository has two branches, one for ink blog source files, and the other for GitHub Pages files. For example, I created a branch named blog-source to store my ink blog source files, and a branch named master to host GitHub Pages files.

  1. Sign in to Travis CI with your GitHub account.
  2. Once you’re signed in, go to your profile page and enable Travis CI for the repository you want to build. step 1: add the blog repository step 2: Flick the blog repository switch on step 3: configure the blog repository step 4: Open this two configuration
  3. Add the Github Access Token to your repository in Travis CI, which can be used to access the GitHub API. Thus, Travis CI can push the files which are generated by InkPaper to GitHub Pages branch. step 5: Generate Github Personal access token step 6: Add Github Personal access token to your repository in Travis CI
  4. Add a .travis.yml file to your repository to tell Travis CI what to build. step 7: configure .travis.yml step 8: output directory
  5. Add the .travis.yml file to git, commit and push, to trigger a Travis CI build.

Now

When we complete a post, and then push it to Github, Travis CI wil do the rest things . All we need to do is focus on writing.

You can find all the code mentioned in the repository: https://github.com/shery15/blog

Creative Commons License
This work by shery is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

shery
Web Front-End Developer