Skip to content

Commit b390548

Browse files
committed
update
1 parent dd34f99 commit b390548

1 file changed

Lines changed: 35 additions & 28 deletions

File tree

.github/workflows/static.yml

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,40 @@ jobs:
5858
echo "}" >> git_config.json
5959
echo "::set-output name=REPO_NAME::$REPO_NAME"
6060
61-
# [!code] 根据实际情况修改
61+
- name: 文档 - 文档库克隆
62+
working-directory: ./src/
63+
run: |
64+
rm README.md
65+
66+
# 文档的克隆、构建、部署。注意 `clone --depth 1` 只拉最近一次提交,减少时间
67+
# git clone --depth 1 https://github.com/${GITHUB_REPOSITORY}.git # 如果有多个clone项则替换成这个,避免冲突
68+
git clone --depth 1 https://github.com/${GITHUB_REPOSITORY}.git temp_repo
69+
70+
# 该仓库为代理仓库,使用链接仓库而非此仓库
71+
if [ -f temp_repo/agency ]; then
72+
GIT_LINK=$(head -n 1 temp_repo/agency)
73+
rm -rf temp_repo
74+
git clone --depth 1 $GIT_LINK temp_repo
75+
echo "with agency"
76+
else
77+
echo "without agency"
78+
fi
79+
80+
- name: 文档 - 文档库docs文件夹的处理
81+
working-directory: ./src/
82+
run: |
83+
if [ -d temp_repo/docs ]; then
84+
find temp_repo/* -maxdepth 0 -name docs -prune -o -exec rm -rf {} \;
85+
mv temp_repo/docs/* .
86+
rm -rf temp_repo
87+
echo "with docs"
88+
else
89+
rsync -a temp_repo/ .
90+
rm -rf temp_repo
91+
echo "without docs"
92+
fi
93+
94+
# [!code] 根据实际情况修改 (需要在仓库配置写入以及和文档仓库clone这两个步骤的后面)
6295
- name: 配置 - 设置
6396
working-directory: ./
6497
run: |
@@ -67,39 +100,13 @@ jobs:
67100
rm -f ./src/.vuepress/config_cover.js
68101
rm -f ./src/.vuepress/theme_cover.js
69102
pnpm run gen-config
70-
71-
# === 新增步骤:强制升级 VuePress 核心以匹配插件 ===
72-
- name: 环境 - 修复依赖版本冲突
73-
working-directory: ./
74-
run: |
75-
echo "正在清理 Vue 2 旧依赖..."
76-
# [!code ++] 新增下面这一行:强制移除 Vue 2 的服务端渲染包和模板编译器
77-
pnpm remove vue-server-renderer vue-template-compiler || true
78-
79-
echo "正在强制升级 vuepress 核心依赖..."
80-
# [!code ++] 建议显式指定 vue 版本,确保万无一失
81-
pnpm add -D vuepress@latest @vuepress/client@latest @vuepress/utils@latest vue@latest
82-
# ===============================================
83-
84-
# 文档的克隆、构建、部署。注意 `clone --depth 1` 只拉最近一次提交,减少时间
85-
- name: 文档 - 文档库克隆
86-
working-directory: ./src/
87-
run: |
88-
# --depth 1 选项会损失git历史,但能加速编译。可自行启用/关闭
89-
# 注意若使用该选项,必须要删除 .git 文件夹,避免时间和贡献者错乱
90-
git clone --depth 1 https://github.com/${GITHUB_REPOSITORY}.git temp_repo
91-
rm -rf temp_repo/.git
92-
rsync -a temp_repo/ .
93-
rm -rf temp_repo
94-
# git clone --depth 1 https://github.com/${GITHUB_REPOSITORY}.git # 如果有多个clone项则替换成这个,避免冲突
95103
96104
- name: 文档 - 构建
97105
env:
98106
NODE_OPTIONS: --max_old_space_size=20480
99107
run: |-
100108
node -e 'console.log(v8.getHeapStatistics())'
101-
# pnpm run docs:build
102-
pnpm exec vuepress build src
109+
pnpm run docs:build
103110
> src/.vuepress/dist/.nojekyll
104111
105112
- name: 文档 - 部署

0 commit comments

Comments
 (0)