-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
36 lines (29 loc) · 1.18 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
dist: xenial
language: python
python: 3.7
# 使用python下载已发布的hugo安装更快
before_install:
- sudo apt-get update -qq
- sudo apt-get -yq install apt-transport-https
# install - install any dependencies required
install:
# install latest hugo release version
- wget -qO- https://api.github.com/repos/gohugoio/hugo/releases/latest | sed -r -n '/browser_download_url/{/Linux-64bit.deb/{s@[^:]*:[[:space:]]*"([^"]*)".*@\1@g;p;q}}' | xargs wget
- sudo dpkg -i hugo*.deb
- rm -rf public 2> /dev/null
#在travis-ci.com上配置3个环境变量,其中GITHUB_TOKEN是在github.com的 Settings >Developer settings>Personal access tokens里面生成.
before_script:
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git config --global user.email ${GITHUB_EMAIL}
- git config --global user.name ${GITHUB_USERNAME}
script:
- hugo -d ./dist/
after_success:
- MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
- cd dist
- git init
- git remote add origin https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/windmzx/windmzx.github.io
- git add .
- git commit -m ${MESSAGE}
- git push origin master -f
# 使用 -f 覆盖原来的站点文件