@@ -6,15 +6,37 @@ cache: npm
66branches :
77only :
88 -hexo # build hexo branch only
9+ # script:
10+ # - hexo generate # generate static files
11+ # deploy:
12+ # provider: pages
13+ # skip-cleanup: true
14+ # github-token: $GH_TOKEN
15+ # keep-history: true
16+ # on:
17+ # branch: master
18+ # all_branches: true # solve a permission problem
19+ # target_branch: master
20+ # local-dir: public
21+
22+ before_install :
23+ # - npm install -g hexo-cli
24+
25+ # Start: Build Lifecycle
26+ install :
27+ -npm install
28+ -npm install hexo-deployer-git --save
29+
30+ # 执行清缓存,生成网页操作
931script :
10- -hexogenerate # generate static files
11- deploy :
12- provider : pages
13- skip-cleanup : true
14- github-token : $GH_TOKEN
15- keep-history : true
16- on :
17- branch : master
18- all_branches : true # solve a permission problem
19- target_branch : master
20- local-dir : public
32+ -hexoclean
33+ - hexo generate
34+
35+ # 设置git提交名,邮箱;替换真实token到_config.yml文件,最后depoy部署
36+ after_script :
37+ - git config user.name "coderhaotf"
38+ - git config user.email "2415156870@qq.com"
39+ # 替换同目录下的_config.yml文件中gh_token字符串为travis后台刚才配置的变量,注意此处sed命令用了双引号。单引号无效!
40+ - sed -i "s/gh_token/${GH_TOKEN}/g" ./_config.yml
41+ - hexo deploy
42+ # End: Build LifeCycle