-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
48 lines (40 loc) · 1.54 KB
/
.travis.yml
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
language: node_js #设置语言
node_js: stable #设置相应的版本
cache:
apt: true
directories:
- node_modules # 缓存不经常更改的内容
before_install:
- export TZ='Asia/Shanghai' # 更改时区
install:
- npm install #安装hexo及插件
script:
- hexo clean #清除
- hexo g && gulp #生成
after_script:
- git clone https://${GH_REF} .deploy_git # GH_REF是最下面配置的仓库地址
- cd .deploy_git
- git checkout master
- cd ../
- mv .deploy_git/.git/ ./public/ # 这一步之前的操作是为了保留master分支的提交记录,不然每次git init的话只有1条commit
- cd ./public
- git config user.name "mtianyan" #修改name
- git config user.email "1147727180@qq.com" #修改email
- git add .
- git commit -m "Travis CI Auto Builder at `date +"%Y-%m-%d %H:%M"`" # 提交记录包含时间 跟上面更改时区配合
- git push --force --quiet "https://${Travis_Token}@${GH_REF}" master:master #GH_TOKEN是在Travis中配置token的名称
branches:
only:
- master #只监测source分支,source是我的分支的名称,可根据自己情况设置
env:
global:
- GH_REF: github.com/mtianyan/mtianyan.github.io.git #设置GH_REF,注意更改yourname
# configure notifications (email, IRC, campfire etc)
# please update this section to your needs!
# https://docs.travis-ci.com/user/notifications/
notifications:
email:
- 1147727180@qq.com
- mtianyan@outlook.com
on_success: change
on_failure: always