diff --git a/.github/workflows/doc-image-publish.yml b/.github/workflows/doc-image-publish.yml index 681c58637..a1df2b195 100644 --- a/.github/workflows/doc-image-publish.yml +++ b/.github/workflows/doc-image-publish.yml @@ -6,9 +6,12 @@ on: - main paths: - 'docs/**' + pull_request: + paths: + - 'docs/**' release: types: [published] - workflow_dispatch: + workflow_dispatch: permissions: contents: read @@ -16,24 +19,29 @@ permissions: 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 \ No newline at end of file + # 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' || '' }} \ No newline at end of file diff --git a/docs/Dockerfile-deploy b/docs/Dockerfile-deploy index 5a86348c4..ea149ffcb 100644 --- a/docs/Dockerfile-deploy +++ b/docs/Dockerfile-deploy @@ -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/ && \ diff --git a/docs/patchs/fix_0.6.3.patch b/docs/patchs/fix_0.6.3.patch new file mode 100644 index 000000000..e5a8ac7e3 --- /dev/null +++ b/docs/patchs/fix_0.6.3.patch @@ -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",