-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
20 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,41 +3,22 @@ | |
# 确保脚本抛出遇到的错误 | ||
set -e | ||
|
||
|
||
push_addr=`git remote get-url --push origin` # git提交地址,也可以手动设置,比如:[email protected]:xugaoyi/vuepress-theme-vdoing.git | ||
commit_info=`git describe --all --always --long` | ||
dist_path=docs/.vuepress/dist # 打包生成的文件夹路径 | ||
push_branch=gh-pages # 推送的分支 | ||
|
||
# 生成静态文件 | ||
npm run build | ||
|
||
# 进入生成的文件夹 | ||
cd docs/.vuepress/dist | ||
|
||
# deploy to github pages | ||
echo 'b.xugaoyi.com' > CNAME | ||
cd $dist_path | ||
|
||
if [ -z "$GITHUB_TOKEN" ]; then | ||
msg='deploy' | ||
[email protected]:xugaoyi/vuepress-theme-vdoing.git | ||
else | ||
msg='来自github actions的自动部署' | ||
githubUrl=https://xugaoyi:${GITHUB_TOKEN}@github.com/xugaoyi/vuepress-theme-vdoing.git | ||
git config --global user.name "xugaoyi" | ||
git config --global user.email "[email protected]" | ||
fi | ||
git init | ||
git add -A | ||
git commit -m "${msg}" | ||
git push -f $githubUrl master:gh-pages # 推送到github gh-pages分支 | ||
|
||
# deploy to coding pages | ||
# echo 'www.xugaoyi.com\nxugaoyi.com' > CNAME # 自定义域名 | ||
# echo 'google.com, pub-7828333725993554, DIRECT, f08c47fec0942fa0' > ads.txt # 谷歌广告相关文件 | ||
|
||
# if [ -z "$CODING_TOKEN" ]; then # -z 字符串 长度为0则为true;$CODING_TOKEN来自于github仓库`Settings/Secrets`设置的私密环境变量 | ||
# [email protected]:xgy/xgy.git | ||
# else | ||
# codingUrl=https://HmuzsGrGQX:${CODING_TOKEN}@e.coding.net/xgy/xgy.git | ||
# fi | ||
# git add -A | ||
# git commit -m "${msg}" | ||
# git push -f $codingUrl master # 推送到coding | ||
git commit -m "deploy, $commit_info" | ||
git push -f $push_addr HEAD:$push_branch | ||
|
||
cd - | ||
rm -rf docs/.vuepress/dist | ||
rm -rf $dist_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
b.xugaoyi.com |