Skip to content

Commit 03e2e64

Browse files
committed
Fix: travis ci
1 parent 203b384 commit 03e2e64

File tree

3 files changed

+53
-11
lines changed

3 files changed

+53
-11
lines changed

.travis.yml

+35-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
language: node_js
2-
node_js:
3-
- lts/*
2+
node_js: stable
3+
4+
before_script:
5+
- git config --global user.name "Honye"
6+
- git config --global user.email "[email protected]"
7+
- chmod +x ./deploy.sh # 为 shell 文件添加可执行权限
8+
9+
install:
10+
- npm install yarn -g
11+
- yarn
12+
413
script:
5-
- npm run build
6-
deploy:
7-
provider: pages
8-
skip-cleanup: true
9-
local_dir: .vuepress/dist
10-
github-token: $GITHUB_TOKEN # a token generated on github allowing travis to push code on you repository
11-
keep-history: true
12-
on:
13-
branch: vuepress
14+
- yarn build
15+
16+
after_script:
17+
- ./deploy.sh
18+
19+
branches:
20+
only:
21+
- vuepress
22+
cache:
23+
directories:
24+
- node_modules
25+
26+
env:
27+
global:
28+
- GITHUB_REF: github.com/Honye/notes.git
29+
30+
# deploy:
31+
# provider: pages
32+
# skip-cleanup: true
33+
# local_dir: .vuepress/dist
34+
# github-token: $GITHUB_TOKEN # a token generated on github allowing travis to push code on you repository
35+
# keep-history: true
36+
# on:
37+
# branch: vuepress

.vuepress/dist

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 4ede536fcdd69c83e73114a7c50af99725e6e955

deploy.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env sh
2+
3+
# 确保脚本抛出遇到的错误
4+
set -e
5+
6+
# 进入生成的文件夹
7+
cd .vuepress/dist
8+
9+
# 如果是发布到自定义域名
10+
# echo 'www.example.com' > CNAME
11+
12+
git init
13+
git add -A
14+
git commit -m "Travis CI build at `date +"%Y-%m-%d %H:%M:%S"`"
15+
16+
# 发布到 GitHub Pages
17+
git push -f "https://${GITHUB_TOKEN}@${GITHUB_REF}" master:gh-pages

0 commit comments

Comments
 (0)