ci(docs): Fix build doc error (#2383)

Fix build doc error
This commit is contained in:
yyhhyy
2025-03-03 12:28:27 +08:00
committed by GitHub
2 changed files with 25 additions and 5 deletions

View File

@@ -1,5 +1,4 @@
name: Build and push docs image
on:
push:
branches:
@@ -14,15 +13,29 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
branch:
description: 'Branch to build (default: main)'
required: true
default: 'main'
type: string
permissions:
contents: read
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
- name: Debug git status
run: |
echo "Current commit: $(git rev-parse HEAD)"
echo "Current branch: $(git rev-parse --abbrev-ref HEAD || echo 'detached HEAD')"
echo "Main branch commit: $(git rev-parse origin/main)"
echo "Using branch: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -47,6 +60,7 @@ jobs:
file: ./docs/Dockerfile-deploy
platforms: linux/amd64
push: false
# Only run when it is not a PR, build and push the image
- name: Build and push
if: github.event_name != 'pull_request'
@@ -56,4 +70,4 @@ jobs:
file: ./docs/Dockerfile-deploy
platforms: linux/amd64
push: true
tags: eosphorosai/dbgpt-docs:${{ github.ref_name }},eosphorosai/dbgpt-docs:latest
tags: eosphorosai/dbgpt-docs:${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }},eosphorosai/dbgpt-docs:latest

View File

@@ -25,7 +25,13 @@ COPY . /app
# Make sure we have the latest version of the repository
RUN if [ "$CI" = "true" ]; then \
# Check if the repo is shallow before trying to unshallow it
if git rev-parse --is-shallow-repository | grep -q 'true'; then \
git fetch --prune --unshallow; \
else \
echo "Repository is already complete, skipping unshallow"; \
git fetch --prune; \
fi; \
fi
ARG NUM_VERSION=2