logo头像

迪拜 ❤ 天空

travis-ci

travis-ci

获取 travis-ci 项目的 ID 跟 slug

https://api.travis-ci.org/owner/zhangsison/repos

#.travis.yml hexo

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
language: node_js
node_js: 8.9.3
cache: npm
dist: trusty
sudo: required
branches:
only:
- master
before_install:
- openssl aes-256-cbc -K $encrypted_5866e934e077_key -iv $encrypted_5866e934e077_iv
-in id_rsa.enc -out id_rsa -d
- npm install -g hexo-cli
install:
- npm install
script:
- hexo clean
- hexo generate
after_script:
- cd ./public
- git init
- git config user.name "zhangsison"
- git config user.email "1024760955@qq.com"
- git add .
- git commit -m "Update docs"
- git push --force --quiet "https://${Travishexo}@${GH_REF}" master:gh-pages
env:
global:
- GH_REF: github.com/zhangsison/hexo-ci.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
language: node_js

node_js:
- '10'

# 项目所在分支
branches:
only:
- master

before_install:
- openssl aes-256-cbc -K $encrypted_d39583d3635f_key -iv $encrypted_d39583d3635f_iv
-in .travis/id_rsa.enc -out ~/.ssh/id_rsa -d
- chmod 600 ~/.ssh/id_rsa

# - rm -rf node_modules
- eval $(ssh-agent)
- ssh-add ~/.ssh/id_rsa
- cp .travis/ssh_config ~/.ssh/config

# 配置 git 替换为自己的信息
- git config --global user.name 'zhangsison'
- git config --global user.email 1024760955@qq.com
# - rm -rf .deploy_git


# 安装依赖
install:
- npm install hexo-cli -g
- npm install



before_script:
- export TZ='Asia/Shanghai' #设置时区



# 部署的命令
script:
- cross-env YUQUE_TOKEN=$yuque_token npm run deploy
# - npm run deploy

#cache 启用缓存,加快构建速度
cache:
directories:
- "node_modules"

评论系统未开启,无法评论!