Skip to content

Commit ec8f1c4

Browse files
committed
增加脚本部署
1 parent da691c8 commit ec8f1c4

214 files changed

Lines changed: 856 additions & 824 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deploy.sh

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,56 @@
1+
# #!/usr/bin/env sh
2+
3+
# # 确保脚本抛出遇到的错误
4+
# set -e
5+
6+
7+
# push_addr=`git remote get-url --push origin` # git提交地址,也可以手动设置,比如:push_addr=git@github.com:xugaoyi/vuepress-theme-vdoing.git
8+
# commit_info=`git describe --all --always --long`
9+
# dist_path=docs/.vuepress/dist # 打包生成的文件夹路径
10+
# push_branch=gh-pages # 推送的分支
11+
12+
# # 生成静态文件
13+
# npm run build
14+
15+
# # 进入生成的文件夹
16+
# cd $dist_path
17+
18+
# git init
19+
# git add -A
20+
# git commit -m "deploy, $commit_info"
21+
# git push -f $push_addr HEAD:$push_branch
22+
23+
# cd -
24+
# rm -rf $dist_path
25+
26+
27+
128
#!/usr/bin/env sh
229

330
# 确保脚本抛出遇到的错误
431
set -e
532

6-
7-
push_addr=`git remote get-url --push origin` # git提交地址,也可以手动设置,比如:push_addr=git@github.com:xugaoyi/vuepress-theme-vdoing.git
8-
commit_info=`git describe --all --always --long`
9-
dist_path=docs/.vuepress/dist # 打包生成的文件夹路径
10-
push_branch=gh-pages # 推送的分支
11-
1233
# 生成静态文件
1334
npm run build
1435

1536
# 进入生成的文件夹
16-
cd $dist_path
37+
cd docs/.vuepress/dist
1738

39+
# 如果手运行该脚本,则执行if里的,如果是GitHub自动执行该脚本,则是else里的
40+
if [ -z "$GITHUB_TOKEN" ]; then
41+
msg='deploy'
42+
githubUrl=git@github.com:jywangyou/notes-blog.git # 替换自己的 GitHub 仓库地址,SSH格式
43+
else
44+
msg='来自github actions的自动部署'
45+
# 替换自己的 GitHub 仓库地址,更改的是 @后面的地址 以及 把Kele-Bingtang 改为自己用户名
46+
githubUrl=https://jywangyou:${GITHUB_TOKEN}@github.com/jywangyou/notes-blog.git
47+
git config --global user.name "jywangyou" # 修改为自己的 GitHub 用户名
48+
git config --global user.email "2712334479@qq.com" # 修改为自己的 GitHub 邮箱,注册时绑定的邮箱
49+
fi
1850
git init
1951
git add -A
20-
git commit -m "deploy, $commit_info"
21-
git push -f $push_addr HEAD:$push_branch
52+
git commit -m "${msg}"
53+
git push -f $githubUrl master:gh-pages # 推送到github gh-pages分支
2254

23-
cd -
24-
rm -rf $dist_path
55+
cd - # 退回开始所在目录
56+
rm -rf docs/.vuepress/dist

docs/.vuepress/dist/404.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/about/index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/archives/index.html

Lines changed: 28 additions & 28 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/categories/index.html

Lines changed: 27 additions & 27 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/friends/index.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/index.html

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/more/index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/note/es6/index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

docs/.vuepress/dist/note/git/index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)