upupming / upupming.github.io

upupming's Blog
https://upupming.site
Other
1 stars 0 forks source link

Continuous integration hexo blog Build Status

Using hexo-theme-melody and Travis CI to build a beautiful hexo blog in a fast and with-version-control way.

Do all things on source branch.

Configuration

  1. Fork this repo, rename it to your-username.github.io and git clone to your computer.
  2. Delete source/CNAME or change its content to your own custom domain.
  3. Delete the source/_drafts/ and source/_posts/ folders.
  4. Modify other configurations as needed, especially _config.yml in the root folder and the source/_data/melody.yml(Follow the hexo-theme-melody-doc).
  5. Modify .travis.yml and .gitlab-ci.yml for continuous integration build your blog. See this post for more information.
  6. Sync and activate your repo on https://travis-ci.com/.

Environment variables you need to config

For security, we should not publish our personal API keys on GitHub repo.

  1. GH_TOKEN

    See https://github.com/settings/tokens

  2. GL_TOKEN(only if you use GitLab)

    See https://gitlab.com/profile/personal_access_tokens

  3. Algolia search(only if you use Algolia)

    See hexo-algoliasearch/lib/algolia.js

    You need four environment variables: ALGOLIA_APP_ID, ALGOLIA_API_KEY, ALGOLIA_ADMIN_API_KEY and ALGOLIA_INDEX_NAME.

Configure them in Travis settings like below:

Start blogging

  1. Write a post

    $ hexo new post my-first-post
    ... writing...
  2. deploy to the origin

    ./deploy.sh "Added: my first post"

    or just

    ./deploy.sh

    which is equivalent to

    ./deploy.sh "Updated: blog source"