Skip to content

Commit 83f4480

Browse files
committed
update deploy
1 parent 62fe057 commit 83f4480

34 files changed

+3802
-3762
lines changed

.github/workflows/deploy.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
21
name: 部署文档
32

43
on:
54
push:
65
branches:
7-
- master # 只在master上push触发部署
6+
- docs # 只在 docs 上 push 触发部署
87
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
98
- README.md
109
- LICENSE
1110
pull_request:
1211
branches:
13-
- master # 只在master上push触发部署
12+
- docs # 只在 docs 上 push 触发部署
1413
types: [closed]
1514

1615
permissions:
@@ -27,8 +26,6 @@ jobs:
2726
# 如果你文档需要 Git 子模块,取消注释下一行
2827
# submodules: true
2928

30-
31-
3229
- name: 设置 Node.js
3330
uses: actions/setup-node@v3
3431
with:
@@ -51,3 +48,31 @@ jobs:
5148
# 这是文档部署到的分支名称
5249
branch: gh-pages
5350
folder: src/.vuepress/dist
51+
52+
deploy-main:
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v2
58+
59+
- name: Switch to main branch
60+
run: |
61+
git checkout main || git checkout --orphan main
62+
63+
- name: Clean up main branch
64+
run: |
65+
# 清空 src 以外的所有文件,限制深度为 1
66+
find . -maxdepth 1 -not -path './src' -not -path './.git' -exec rm -rf {} +
67+
# 移动 src 中的文件到根目录
68+
mv src/* ./
69+
# 删除 src 和 .vuepress 文件夹
70+
rm -rf src .vuepress
71+
72+
- name: Commit and push changes
73+
run: |
74+
git config --local user.name "github-actions"
75+
git config --local user.email "github-actions@github.com"
76+
git add .
77+
git commit -m "Update main branch with src files" || echo "No changes to commit"
78+
git push origin main

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
dist/
22
node_modules/
33
src/.vuepress/.cache/
44
src/.vuepress/.temp/

assets/image/react-1.png

-115 KB
Binary file not shown.

assets/image/react-10.png

-188 KB
Binary file not shown.

assets/image/react-11.png

-126 KB
Binary file not shown.

assets/image/react-12.png

-234 KB
Binary file not shown.

assets/image/react-13.png

-247 KB
Binary file not shown.

assets/image/react-14.png

-191 KB
Binary file not shown.

assets/image/react-2.png

-139 KB
Binary file not shown.

assets/image/react-3.png

-121 KB
Binary file not shown.

0 commit comments

Comments
 (0)