What i did to setup this site

Welcome to my blog! This is my very first post. It records the steps about how to setup personal blog site on github and how to use travis CI to auto deploy the changes.

Steps

Create a new repo and push to github

1
repo must be named account_name.github.io

Init hexo

1
2
3
$ hexo init blog
$ cd blog
$ npm i

Update _config.yml for common

1
url: https://username.github.io

Update _config.yml for deploy

1
2
3
4
deploy:
type: git
repo: git@github.com:username/username.github.io.git
branch: gh-pages

Update theme

1
2
3
npm i hexo-theme-next --save

copy _config.next.yml to the root directory

or

1
2
3
$ cd hexo
$ git clone https://github.com/theme-next/hexo-theme-next themes/next

1
2
modify _config.yml as below
theme: next

Generate static files

1
2
$ hexo clean
$ hexo generate

Deploy to remote sites manually

1
2
$ npm i hexo-deployer-git
$ hexo deploy

Deploy to remote sites by travis CI

1
2
3
generate githup personal access token
grant github repo permission to travis
add token to travis Environment Variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add .travis.yml 

sudo: false
language: node_js
node_js:
- 16 # use nodejs v10 LTS
cache: npm
branches:
only:
- master # build master branch only
script:
- hexo clean
- hexo generate # generate static files
deploy:
provider: pages
skip-cleanup: true
github-token: $GH_TOKEN
keep-history: true
on:
branch: master
local-dir: public

Customize domain

1
2
3
purchase personal domain from ali yun
parse my github page ip with domain
update new domain in github page of this repo setting page