-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
39 lines (28 loc) · 1.36 KB
/
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
37
38
39
#!/usr/bin/env sh
# 确保脚本抛出遇到的错误
set -e
# 打包生成静态文件
pnpm run docs:build
# 进入生成的文件夹
cd docs/.vitepress/dist
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
time=$(date "+%Y-%m-%d %H:%M:%S")
git init
git add -A
git commit -m "GitHub Action 自动部署:$time"
# # 如果发布到 https://<USERNAME>.github.io -f 强制推送
# git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git main
git push -f [email protected]:muyaCode/program-learn-notes.git main:gh-pages # 发布到Gitee
# git push -f [email protected]:muyaCode/program-learn-notes.git main:gh-pages # 发布到GitHub
# 退出到本项目根目录
cd -
# 删除 打包成的dist文件目录
rm -rf docs/.vitepress/dist
# echo "仓库地址:https://github.com/muyaCode/program-learn-notes"
# echo "文档地址:https://muyacode.github.io/program-learn-notes/"
# 格式化输出带颜色配置:https://www.shuzhiduo.com/A/D854N3mVzE/
echo -e "Gitee仓库地址:\033[44;37m https://gitee.com/muyaCode/program-learn-notes/ \033[0m"
echo -e "GiteePages文档地址:\033[47;30m https://muyacode.gitee.io/program-learn-notes/ \033[0m"
# echo -e "GitHub仓库地址:\033[44;37m https://github.com/muyaCode/program-learn-notes/ \033[0m"
# echo -e "GitHubPages文档地址:\033[47;30m https://muyacode.github.io/program-learn-notes/ \033[0m"