Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const config = {
url: "https://developer.d-robotics.cc",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/docs/",
// baseUrl 与各兄弟仓一致取 repo 名(/<projectName>/),产物最终进 gh-pages 的 /xburn_doc 子路径
baseUrl: "/xburn_doc/",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
Expand Down Expand Up @@ -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: [
{
Expand Down
Loading