Skip to content

Travis CI部署hexo

Published:

几个配置

An image

An image

An image

An image

yml文件配置

新建并且切换到分支source

git checkout -b source

将本地hexo项目源码复制过来并且新建一个.travis.yml文件(Travis-CI的部署配置文件)

language: node_js
node_js: stable
install:
  - npm install
script:
  - hexo clean && hexo g

after_script:
  - cd ./public
  - git init
  - git config user.name "xxx"
  - git config user.email "xxx"
  - git add .
  - git commit -m ":memo:\ Update blog by Travis CI"
  - git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:master

branches:
  only:
    - source
env:
  global:
    - GH_REF: github.com/xxx/xxx.github.io.git

push分支到远程Travis-CI branch

git push origin source:source

最后

只需要在source/_posts/文件夹下增删改.md文件然后push分支就可以了,剩下的事情就交给Travis CI了