travis部署hexo

生成ssh秘钥,并给秘钥加密

1
2
3
gem install travis
travis login --auto
travis encrypt-file bwg --add

web仓库:git@bitbucket.org:ppdg123/ghblog_source.git
md仓库 : git@github.com:ppdg123/ghblog_md.git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
language: node_js 
node_js:
- '0.10'
addons:
ssh_known_hosts:
- bitbucket.org
- github.com
before_install:
- openssl aes-256-cbc -K $encrypted_15b7554ef6b7_key -iv $encrypted_15b7554ef6b7_iv -in bwg.enc -out ~/.ssh/bwg -d
- chmod 600 ~/.ssh/bwg
- eval $(ssh-agent)
- ssh-add ~/.ssh/bwg
- cp .travis/ssh_config ~/.ssh/config
- git config --global user.name "Wang@Travis"
- git config --global user.email ppdg@foxmail.com
- npm install hexo-cli -g
- npm install hexo-deployer-git --save
- git clone git@bitbucket.org:ppdg123/ghblog_source.git ghblog
- cd ./ghblog/
- npm install
- cd ./source/
- git clone git@github.com:ppdg123/ghblog_md.git _posts
script:
- hexo clean
- hexo g
- hexo d
branches:
only:
- master