Skip to content

Commit de629f4

Browse files
authored
fix(docs): Fix document build error (#2271)
1 parent 0e3b2dc commit de629f4

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

.github/workflows/doc-image-publish.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,42 @@ on:
66
- main
77
paths:
88
- 'docs/**'
9+
pull_request:
10+
paths:
11+
- 'docs/**'
912
release:
1013
types: [published]
11-
workflow_dispatch:
14+
workflow_dispatch:
1215

1316
permissions:
1417
contents: read
1518

1619
jobs:
1720
build-image:
1821
runs-on: ubuntu-latest
19-
# run unless event type is pull_request
20-
if: github.event_name != 'pull_request'
2122
steps:
2223
- uses: actions/checkout@v3
24+
2325
- name: Set up QEMU
2426
uses: docker/setup-qemu-action@v2
27+
2528
- name: Set up Docker Buildx
2629
uses: docker/setup-buildx-action@v2
30+
31+
# Only login to Docker Hub when not in PR
2732
- name: Login to Docker Hub
33+
if: github.event_name != 'pull_request'
2834
uses: docker/login-action@v2
2935
with:
3036
username: ${{ secrets.DOCKERHUB_USERNAME }}
3137
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
3239
- name: Build and push
3340
uses: docker/build-push-action@v4
3441
with:
3542
context: .
3643
file: ./docs/Dockerfile-deploy
3744
platforms: linux/amd64
38-
push: true
39-
tags: eosphorosai/dbgpt-docs:${{ github.ref_name }},eosphorosai/dbgpt-docs:latest
45+
# Only push when not in PR
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ${{ github.event_name != 'pull_request' && 'eosphorosai/dbgpt-docs:${{ github.ref_name }},eosphorosai/dbgpt-docs:latest' || '' }}

docs/Dockerfile-deploy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ RUN git config --global --add safe.directory /app && \
5151
echo "Creating version $TAG"; \
5252
cd /app/docs && git checkout $TAG; \
5353
echo "Checked out to tag: $TAG"; \
54+
# Check if there is a patch for the current version in app-build
55+
echo "Checking patch in /app-build/docs/patchs..." && \
56+
if [ -f "/app-build/docs/patchs/fix_${TAG/v/}.patch" ]; then \
57+
echo "Found patch for version $TAG in /app-build/docs/patchs, applying..."; \
58+
cd /app && \
59+
git apply "/app-build/docs/patchs/fix_${TAG/v/}.patch" && \
60+
echo "Patch applied successfully" || \
61+
echo "Failed to apply patch for $TAG"; \
62+
echo "Current sidebars.js content:"; \
63+
cat /app/docs/sidebars.js; \
64+
else \
65+
echo "No patch found for $TAG in /app-build/docs/patchs"; \
66+
fi; \
5467
# Copy the necessary files to the build directory for each tag
5568
rm -rf /app-build/docs/docs /app-build/docs/sidebars.js /app-build/docs/static /app-build/docs/src && \
5669
cp -r /app/docs/docs /app-build/docs/ && \

docs/patchs/fix_0.6.3.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/docs/sidebars.js b/docs/sidebars.js
2+
index e95be6d2..561bc8f7 100755
3+
--- a/docs/sidebars.js
4+
+++ b/docs/sidebars.js
5+
@@ -186,7 +186,7 @@ const sidebars = {
6+
id: "awel/awel_tutorial/advanced_guide/4.1_lifecycle"
7+
}
8+
]
9+
- },,
10+
+ },
11+
{
12+
type: "category",
13+
label: "5. AWEL Template",

0 commit comments

Comments
 (0)