-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
51 lines (44 loc) · 1.58 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
49
50
51
language: go
go:
- "1.8" # 指定Golang 1.8
# Specify which branches to build using a safelist
# 分支白名单限制:只有 master 分支的提交才会触发构建
# branches:
# only:
# - master
install:
# 安装最新的hugo
- wget https://github.com/gohugoio/hugo/releases/download/v0.69.1/hugo_0.69.1_Linux-64bit.deb
- sudo dpkg -i hugo*.deb
# 安装主题
# git clone https://github.com/flysnow-org/maupassant-hugo.git themes/maupassant
- git clone https://github.com/dillonzq/LoveIt.git themes/LoveIt
script:
# 运行hugo命令
- hugo
after_script:
# 部署
- cd ./public
- git init
- git config user.name "alatan"
- git config user.email "[email protected]"
- git add .
- git commit -m "Update Blog By TravisCI With Build $TRAVIS_BUILD_NUMBER"
# Github Pages
- git push --force --quiet "https://$GITHUB_TOKEN@${GH_REF}" master:master
# Github Pages
- git push --quiet "https://$GITHUB_TOKEN@${GH_REF}" master:master --tags
env:
global:
# Github Pages
- GH_REF: github.com/alatan/alatan.github.io.git
deploy:
provider: pages # 重要,指定这是一份github pages的部署配置
skip-cleanup: true # 重要,不能省略
local-dir: public # 静态站点文件所在目录
# target-branch: master # 要将静态站点文件发布到哪个分支
github-token: $GITHUB_TOKEN # 重要,$GITHUB_TOKEN是变量,需要在GitHub上申请、再到配置到Travis
# fqdn: moge.fun # 如果是自定义域名,此处要填
keep-history: true # 是否保持target-branch分支的提交记录
on:
branch: master # 博客源码的分支