forked from HerryLo/BlogPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
36 lines (27 loc) · 975 Bytes
/
deploy.sh
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
#!/usr/bin/env sh
# https://www.sojson.com/robots/ 生成Robots.txt
# https://www.xml-sitemaps.com/ 生成sitemap.xml站点地图
# 确保脚本抛出遇到的错误
set -e
# fd0073ed132eb69233860692ecb5cae8cafa61aa
basepath=$(cd `dirname $0`; pwd)
sourcePath=$basepath'/docs/.vuepress/dist/'
echo "开始构建项目"
# 生成静态文件
npm run build
echo "构建完毕"
cd $sourcePath
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
git init
git config user.name "HerryLo"
git config user.email "[email protected]"
git add -A
git commit -m 'deploy'
# 如果发布到 https://<USERNAME>.github.io
# git push -f [email protected]:HerryLo/HerryLo.github.io.git master
# 如果发布到 https://<USERNAME>.github.io/<REPO>
# git push -f [email protected]:<USERNAME>/<REPO>.git master:gh-pages
git push -f [email protected]:HerryLo/HerryLo.github.io.git master
# git push -f https://${access_token}@github.com/HerryLo/HerryLo.github.io.git master
cd -