Skip to content

Commit 6b9f644

Browse files
committed
:feat 增加windows 部署脚本
1 parent 7f93c5b commit 6b9f644

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ replay_pid*
2626
.idea
2727
*.iws
2828
*.iml
29-
*.ipr
29+
*.ipr
30+
31+
/dist/

deploy.bat

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@echo off
2+
3+
:: Ensure script stops on encountering errors
4+
set REPO_URL=git@github.com:xiaoashuo/relaxed-docs.git
5+
set BRANCH_NAME=master
6+
set REMOTE_BRANCH_NAME=gh_pages
7+
:: Generate static files
8+
call yarn docs:build
9+
10+
:: Enter the generated folder
11+
cd docs\.vuepress\dist
12+
:: dir
13+
:: If deploying to a custom domain
14+
:: echo 'www.example.com' > CNAME
15+
16+
:: Initialize a new Git repository
17+
call git init
18+
19+
call git add -A
20+
call git commit -m "deploy"
21+
22+
23+
:: If deploying to https://<USERNAME>.github.io
24+
:: git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
25+
26+
:: If deploying to https://<USERNAME>.github.io/<REPO>
27+
:: call git push -f git@github.com:xiaoashuo/relaxed-docs.git master:gh_pages
28+
call git push -f %REPO_URL% %BRANCH_NAME%:%REMOTE_BRANCH_NAME%
29+
30+
:: 检查上一个命令的退出代码
31+
if %errorlevel% neq 0 (
32+
echo 错误:推送到GitHub失败。
33+
exit /b %errorlevel%
34+
)
35+
:: Return to the original directory
36+
cd ..
37+
pause()
38+
39+

0 commit comments

Comments
 (0)