From a60950c806eb26b3671682c286e2af807c67cb0c Mon Sep 17 00:00:00 2001 From: xburn-doc Date: Thu, 16 Jul 2026 21:45:37 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20push=20main=20=E8=87=AA=E5=8A=A8=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E5=88=B0=20gh-pages(=E5=85=88=E9=AA=8C=E9=93=BE?= =?UTF-8?q?=E8=B7=AF)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit baseUrl /docs/ → /xburn_doc/(与兄弟仓 // 命名一致),新建 self-hosted deploy.yml:push main → build → USE_SSH=true npm run deploy 出 gh-pages。 只动这两个配置验链路;内容文档改动留后续 push。OSS 统一站集成留 W2。 Co-Authored-By: Claude --- .github/workflows/deploy.yml | 72 ++++++++++++++++++++++++++++++++++++ docusaurus.config.js | 5 ++- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..d06d634 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,72 @@ +name: Deploy Docusaurus site to GitHub Pages + +on: + push: + branches: + - main # 当 main 分支有推送时触发部署 + workflow_dispatch: # 允许手动触发 + +jobs: + build: + runs-on: self-hosted # 绕开组织 Actions 计费(同 rdk_x_doc) + + steps: + - name: Tune Git for unstable network + run: | + git config --global http.postBuffer 524288000 + git config --global http.version HTTP/1.1 + git config --global http.lowSpeedLimit 1000 + git config --global http.lowSpeedTime 600 + + - name: Checkout repository + id: checkout + uses: actions/checkout@v4 + continue-on-error: true + timeout-minutes: 15 + + - name: Retry checkout repository + if: steps.checkout.outcome != 'success' + uses: actions/checkout@v4 + timeout-minutes: 15 + + - name: Detect local Node.js on runner + id: detect_node + run: | + if command -v node >/dev/null 2>&1 && command -v npm >/dev/null 2>&1; then + echo "has_node=true" >> "$GITHUB_OUTPUT" + echo "Using local Node.js:" + node -v + npm -v + else + echo "has_node=false" >> "$GITHUB_OUTPUT" + fi + + - name: Setup Node.js (fallback) + if: steps.detect_node.outputs.has_node != 'true' + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + + - name: Clean install dependencies + run: | + rm -rf node_modules + npm ci + + - name: Build Docusaurus site + run: npm run build + + - name: Set up Git config + run: | + git config --global user.email "2560288119@qq.com" + git config --global user.name "liqinglian01" + + - name: Setup SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan github.com >> ~/.ssh/known_hosts + + - name: Deploy to GitHub Pages + run: USE_SSH=true npm run deploy diff --git a/docusaurus.config.js b/docusaurus.config.js index fdffc29..edc9839 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -15,7 +15,8 @@ const config = { url: "https://developer.d-robotics.cc", // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: "/docs/", + // baseUrl 与各兄弟仓一致取 repo 名(//),产物最终进 gh-pages 的 /xburn_doc 子路径 + baseUrl: "/xburn_doc/", // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. @@ -76,7 +77,7 @@ const config = { logo: { alt: "地瓜机器人社区 logo", src: "img/logo.png", - href: "https://d-robotics.cc/", // 修改为文档根路径 + href: "https://d-robotics.cc/", // brand 由 src/theme/Navbar/Logo swizzle 接管,此 href 不生效 }, items: [ {