This is an automated email from the ASF dual-hosted git repository.

fanjia pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 4406fbc0a0 [Fix][Doc] Fix zh doc build error (#7882)
4406fbc0a0 is described below

commit 4406fbc0a0516c8152df3370d37534348a0f8cc4
Author: Jia Fan <[email protected]>
AuthorDate: Tue Oct 22 10:08:39 2024 +0800

    [Fix][Doc] Fix zh doc build error (#7882)
---
 .github/workflows/backend.yml           | 38 +++++++++++++++++++
 .github/workflows/documents.yml         | 66 ---------------------------------
 docs/zh/seatunnel-engine/rest-api-v1.md |  4 +-
 docs/zh/seatunnel-engine/rest-api-v2.md |  4 +-
 tools/documents/sync.sh                 | 28 ++++++++++----
 5 files changed, 63 insertions(+), 77 deletions(-)

diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml
index f98ac8c80a..34645086d4 100644
--- a/.github/workflows/backend.yml
+++ b/.github/workflows/backend.yml
@@ -125,6 +125,12 @@ jobs:
           echo "deleted-poms=$true_or_false" >> $GITHUB_OUTPUT
           echo "deleted-poms_files=$file_list" >> $GITHUB_OUTPUT
           
+          doc_files=`python tools/update_modules_check/check_file_updates.py 
ua $workspace apache/dev origin/$current_branch "docs/**"`
+          true_or_false=${doc_files%%$'\n'*}
+          file_list=${doc_files#*$'\n'}
+          echo "docs=$true_or_false" >> $GITHUB_OUTPUT
+          echo "docs_files=$file_list" >> $GITHUB_OUTPUT
+          
           engine_e2e_files=`python 
tools/update_modules_check/check_file_updates.py ua $workspace apache/dev 
origin/$current_branch "seatunnel-e2e/seatunnel-engine-e2e/**"`
           true_or_false=${engine_e2e_files%%$'\n'*}
           file_list=${engine_e2e_files#*$'\n'}
@@ -268,6 +274,38 @@ jobs:
       - name: Check Dependencies Licenses
         run: tools/dependencies/checkLicense.sh
 
+  document:
+    if: needs.changes.outputs.api == 'true' || needs.changes.outputs.docs == 
'true'
+    needs: [ changes, sanity-check ]
+    name: Build website
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    steps:
+      - name: Checkout PR
+        uses: actions/checkout@v3
+        with:
+          path: seatunnel-pr
+
+      - name: Checkout website repo
+        uses: actions/checkout@v3
+        with:
+          repository: apache/seatunnel-website
+          path: seatunnel-website
+
+      - name: Sync PR changes to website
+        run: |
+          bash seatunnel-pr/tools/documents/sync.sh seatunnel-pr 
seatunnel-website
+
+      - uses: actions/setup-node@v2
+        with:
+          node-version: 16.19.0
+
+      - name: Run docusaurus build
+        run: |
+          cd seatunnel-website
+          npm set strict-ssl false
+          npm install
+          npm run build
   unit-test:
     needs: [ changes, sanity-check ]
     if: needs.changes.outputs.api == 'true' || (needs.changes.outputs.api == 
'false' && needs.changes.outputs.ut-modules != '')
diff --git a/.github/workflows/documents.yml b/.github/workflows/documents.yml
deleted file mode 100644
index 61d064f010..0000000000
--- a/.github/workflows/documents.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the 'License'); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an 'AS IS' BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-name: Documents
-
-on:
-  pull_request:
-    paths:
-      - 'docs/**'
-
-jobs:
-  build:
-    name: Build website
-    runs-on: ubuntu-latest
-    timeout-minutes: 60
-    steps:
-      - name: Checkout PR
-        uses: actions/checkout@v3
-        with:
-          path: seatunnel-pr
-
-      - name: Checkout website repo
-        uses: actions/checkout@v3
-        with:
-          repository: apache/seatunnel-website
-          path: seatunnel-website
-
-      - name: Sync PR changes to website
-        run: |
-          bash seatunnel-pr/tools/documents/sync.sh seatunnel-pr 
seatunnel-website
-
-      - uses: actions/setup-node@v2
-        with:
-          node-version: 16.19.0
-
-      - name: Run docusaurus build
-        run: |
-          cd seatunnel-website
-          npm set strict-ssl false
-          npm install
-          npm run build
-
-  code-style:
-    name: Code style
-    runs-on: ubuntu-latest
-    timeout-minutes: 10
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          submodules: true
-      - name: Check code style
-        run: ./mvnw --batch-mode --quiet --no-snapshot-updates clean 
spotless:check
diff --git a/docs/zh/seatunnel-engine/rest-api-v1.md 
b/docs/zh/seatunnel-engine/rest-api-v1.md
index d9ae96714a..5aa9f111df 100644
--- a/docs/zh/seatunnel-engine/rest-api-v1.md
+++ b/docs/zh/seatunnel-engine/rest-api-v1.md
@@ -786,7 +786,7 @@ network:
 ### 获取所有节点日志内容
 
 <details>
- <summary><code>GET</code> 
<code><b>/hazelcast/rest/maps/logs/:jobId</b></code> 
<code>(返回日志列表。)</code></summary></summary>
+ <summary><code>GET</code> 
<code><b>/hazelcast/rest/maps/logs/:jobId</b></code> 
<code>(返回日志列表。)</code></summary>
 
 #### 请求参数
 
@@ -837,7 +837,7 @@ network:
 ### 获取单节点日志内容
 
 <details>
- <summary><code>GET</code> <code><b>/hazelcast/rest/maps/log</b></code> 
<code>(返回日志列表。)</code></summary></summary>
+ <summary><code>GET</code> <code><b>/hazelcast/rest/maps/log</b></code> 
<code>(返回日志列表。)</code></summary>
 
 #### 响应
 
diff --git a/docs/zh/seatunnel-engine/rest-api-v2.md 
b/docs/zh/seatunnel-engine/rest-api-v2.md
index 26ca116845..4964415cb2 100644
--- a/docs/zh/seatunnel-engine/rest-api-v2.md
+++ b/docs/zh/seatunnel-engine/rest-api-v2.md
@@ -748,7 +748,7 @@ seatunnel:
 ### 获取所有节点日志内容
 
 <details>
- <summary><code>GET</code> <code><b>/logs/:jobId</b></code> 
<code>(返回日志列表。)</code></summary></summary>
+ <summary><code>GET</code> <code><b>/logs/:jobId</b></code> 
<code>(返回日志列表。)</code></summary>
 
 #### 请求参数
 
@@ -800,7 +800,7 @@ seatunnel:
 ### 获取单节点日志内容
 
 <details>
- <summary><code>GET</code> <code><b>/log</b></code> 
<code>(返回日志列表。)</code></summary></summary>
+ <summary><code>GET</code> <code><b>/log</b></code> 
<code>(返回日志列表。)</code></summary>
 
 #### 响应
 
diff --git a/tools/documents/sync.sh b/tools/documents/sync.sh
index b30d93d57f..b57eb9779e 100644
--- a/tools/documents/sync.sh
+++ b/tools/documents/sync.sh
@@ -24,11 +24,14 @@ PR_IMG_DIR="${PR_DIR}/docs/images"
 PR_IMG_ICON_DIR="${PR_DIR}/docs/images/icons"
 PR_DOC_DIR="${PR_DIR}/docs/en"
 PR_SIDEBAR_PATH="${PR_DIR}/docs/sidebars.js"
+PR_ZH_DOC_DIR="${PR_DIR}/docs/zh"
 
 WEBSITE_DIR=$2
 WEBSITE_IMG_DIR="${WEBSITE_DIR}/static/image_en"
+WEBSITE_ZH_IMG_DIR="${WEBSITE_DIR}/static/image_zh"
 WEBSITE_DOC_DIR="${WEBSITE_DIR}/docs"
 WEBSITE_ICON_DIR="${WEBSITE_DIR}/docs/images/icons"
+WEBSITE_ZH_DOC_DIR="${WEBSITE_DIR}/i18n/zh-CN/docusaurus-plugin-content-docs/current"
 
 DOCUSAURUS_DOC_SIDEBARS_FILE="${WEBSITE_DIR}/sidebars.js"
 
@@ -85,18 +88,19 @@ function rm_exists_files() {
 ##############################################################
 function replace_images_path(){
   replace_dir=$1
+  target=$2
   for file_path in "${replace_dir}"/*; do
     if test -f "${file_path}"; then
       if [ "${file_path##*.}"x = "md"x ] || [ "${file_path##*.}"x = "mdx"x ]; 
then
-        echo "  ---> Replace images path to /doc/image_en in ${file_path}"
+        echo "  ---> Replace images path to /doc/${target} in ${file_path}"
         if [[ "$OSTYPE" == "darwin"* ]]; then
-          sed -E -i '' "s/(\.\.\/)*images/\/image_en/g" "${file_path}"
+          sed -E -i '' "s/(\.\.\/)*images/\/${target}/g" "${file_path}"
         else
-          sed -E -i "s/(\.\.\/)*images/\/image_en/g" "${file_path}"
+          sed -E -i "s/(\.\.\/)*images/\/${target}/g" "${file_path}"
         fi
       fi
     else
-      replace_images_path "${file_path}"
+      replace_images_path "${file_path}" "${target}"
     fi
   done
 }
@@ -107,8 +111,9 @@ function replace_images_path(){
 function prepare_docs() {
     echo "===>>>: Start documents sync."
 
-    echo "===>>>: Rebuild directory docs, static/image_en."
+    echo "===>>>: Rebuild directory docs, static/image_en(zh)."
     rebuild_dirs "${WEBSITE_DOC_DIR}" "${WEBSITE_IMG_DIR}"
+    rebuild_dirs "${WEBSITE_DOC_DIR}" "${WEBSITE_ZH_IMG_DIR}"
 
     echo "===>>>: Remove exists file sidebars.js."
     rm_exists_files "${DOCUSAURUS_DOC_SIDEBARS_FILE}"
@@ -119,15 +124,24 @@ function prepare_docs() {
     echo "===>>>: Rsync images to ${WEBSITE_IMG_DIR}"
     rsync -av --exclude='/icons' "${PR_IMG_DIR}"/ "${WEBSITE_IMG_DIR}"
 
+    echo "===>>>: Rsync images to ${WEBSITE_ZH_IMG_DIR}"
+    rsync -av --exclude='/icons' "${PR_IMG_DIR}"/ "${WEBSITE_ZH_IMG_DIR}"
+
     mkdir -p ${WEBSITE_ICON_DIR}
     echo "===>>>: Rsync icons to ${WEBSITE_ICON_DIR}"
     rsync -av "${PR_IMG_ICON_DIR}"/ "${WEBSITE_ICON_DIR}"
 
-    echo "===>>>: Rsync documents to ${WEBSITE_DOC_DIR}"
+    echo "===>>>: Rsync en documents to ${WEBSITE_DOC_DIR}"
     rsync -av "${PR_DOC_DIR}"/ "${WEBSITE_DOC_DIR}"
 
+    echo "===>>>: Rsync zh documents to ${WEBSITE_ZH_DOC_DIR}"
+    rsync -av "${PR_ZH_DOC_DIR}"/ "${WEBSITE_ZH_DOC_DIR}"
+
     echo "===>>>: Replace images path in ${WEBSITE_DOC_DIR}"
-    replace_images_path "${WEBSITE_DOC_DIR}"
+    replace_images_path "${WEBSITE_DOC_DIR}" "image_en"
+
+    echo "===>>>: Replace images path in ${WEBSITE_ZH_DOC_DIR}"
+    replace_images_path "${WEBSITE_ZH_DOC_DIR}" "image_zh"
 
     echo "===>>>: End documents sync"
 }

Reply via email to