Skip to content

Commit

Permalink
fix(docs): Fix document build error (#2271)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyinc authored Jan 3, 2025
1 parent 0e3b2dc commit de629f4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/doc-image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,42 @@ on:
- main
paths:
- 'docs/**'
pull_request:
paths:
- 'docs/**'
release:
types: [published]
workflow_dispatch:
workflow_dispatch:

permissions:
contents: read

jobs:
build-image:
runs-on: ubuntu-latest
# run unless event type is pull_request
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Only login to Docker Hub when not in PR
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./docs/Dockerfile-deploy
platforms: linux/amd64
push: true
tags: eosphorosai/dbgpt-docs:${{ github.ref_name }},eosphorosai/dbgpt-docs:latest
# Only push when not in PR
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ github.event_name != 'pull_request' && 'eosphorosai/dbgpt-docs:${{ github.ref_name }},eosphorosai/dbgpt-docs:latest' || '' }}
13 changes: 13 additions & 0 deletions docs/Dockerfile-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ RUN git config --global --add safe.directory /app && \
echo "Creating version $TAG"; \
cd /app/docs && git checkout $TAG; \
echo "Checked out to tag: $TAG"; \
# Check if there is a patch for the current version in app-build
echo "Checking patch in /app-build/docs/patchs..." && \
if [ -f "/app-build/docs/patchs/fix_${TAG/v/}.patch" ]; then \
echo "Found patch for version $TAG in /app-build/docs/patchs, applying..."; \
cd /app && \
git apply "/app-build/docs/patchs/fix_${TAG/v/}.patch" && \
echo "Patch applied successfully" || \
echo "Failed to apply patch for $TAG"; \
echo "Current sidebars.js content:"; \
cat /app/docs/sidebars.js; \
else \
echo "No patch found for $TAG in /app-build/docs/patchs"; \
fi; \
# Copy the necessary files to the build directory for each tag
rm -rf /app-build/docs/docs /app-build/docs/sidebars.js /app-build/docs/static /app-build/docs/src && \
cp -r /app/docs/docs /app-build/docs/ && \
Expand Down
13 changes: 13 additions & 0 deletions docs/patchs/fix_0.6.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/docs/sidebars.js b/docs/sidebars.js
index e95be6d2..561bc8f7 100755
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -186,7 +186,7 @@ const sidebars = {
id: "awel/awel_tutorial/advanced_guide/4.1_lifecycle"
}
]
- },,
+ },
{
type: "category",
label: "5. AWEL Template",

0 comments on commit de629f4

Please sign in to comment.