diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index b0f9a27ec7..b630fe5474 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -49,15 +49,9 @@ jobs: - name: Install quarto uses: quarto-dev/quarto-actions/setup@v2 - - name: Generate API documentation - run: | - python ./process_api_reference.py - working-directory: website - - - name: Convert Jupyter notebooks to MDX - run: | - python ./process_notebooks.py render - working-directory: website + - name: Build documentation + run: ./scripts/docs_build.sh + working-directory: . - name: Prepare website content run: | @@ -95,15 +89,9 @@ jobs: - name: Install quarto uses: quarto-dev/quarto-actions/setup@v2 - - name: Generate API documentation - run: | - python ./process_api_reference.py - working-directory: website - - - name: Convert Jupyter notebooks to MDX - run: | - python ./process_notebooks.py render - working-directory: website + - name: Build documentation + run: ./scripts/docs_build.sh + working-directory: . - name: Prepare website content run: | diff --git a/scripts/docs_build.sh b/scripts/docs_build.sh index e07029cccf..2d8ffeb5fb 100755 --- a/scripts/docs_build.sh +++ b/scripts/docs_build.sh @@ -3,7 +3,14 @@ set -e set -x -cd website && - yarn install --frozen-lockfile --ignore-engines && - pydoc-markdown && - yarn build +# Function to build documentation +docs_build() { + cd website && + python ./process_api_reference.py && + python ./process_notebooks.py render +} + +# Execute the function only if the script is run directly +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + docs_build +fi diff --git a/scripts/docs_serve.sh b/scripts/docs_serve.sh index 99239e7cd3..acc0ee0823 100755 --- a/scripts/docs_serve.sh +++ b/scripts/docs_serve.sh @@ -3,7 +3,16 @@ set -e set -x -cd website && - yarn install --frozen-lockfile --ignore-engines && - pydoc-markdown && - yarn start +# Source the docs_build.sh script from the same directory +source "$(dirname "$0")/docs_build.sh" + +# Run the docs_build function from docs_build.sh +docs_build + +# Install npm packages +echo "Running npm install..." +npm install + +# Add the command to serve the documentation +echo "Serving documentation..." +npm run mintlify:dev diff --git a/website/README.md b/website/README.md index 01bff706ef..7bdd03be4e 100644 --- a/website/README.md +++ b/website/README.md @@ -25,11 +25,7 @@ pip install pydoc-markdown pyyaml termcolor nbclient 3. Finally, run the following commands to build and serve the documentation: ```console -cd website -python ./process_api_reference.py -python ./process_notebooks.py render -npm install -npm run mintlify:dev +./scripts/docs_serve.sh ``` The last command starts a local development server and opens up a browser window. @@ -52,11 +48,7 @@ docker run -it -p 8081:3000 -v $(pwd):/home/autogen/ag2 ag2ai_dev_img bash Once at the CLI in Docker run the following commands: ```console -cd website -python ./process_api_reference.py -python ./process_notebooks.py render -npm install -npm run mintlify:dev +./scripts/docs_serve.sh ``` Once done you should be able to access the documentation at `http://127.0.0.1:8081` diff --git a/website/build_website.sh b/website/build_website.sh deleted file mode 100755 index e4d6441be1..0000000000 --- a/website/build_website.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# This script generates documentation using pydoc-markdown and renders the website using Quarto. -# - -missing_deps=false - -# -# Check for missing dependencies, report them, and exit when building the -# website is likely to fail. -# -for dependency in node pydoc-markdown quarto python yarn npm -do - if ! command -v "$dependency" &> /dev/null - then - echo "Command '$dependency' not found." - missing_deps=true - fi -done - -if [ "$missing_deps" = true ] -then - echo -e "\nSome of the dependencies are missing." - echo "Please install them to build the website." - exit 1 -fi - -# Generate documentation using pydoc-markdown -pydoc-markdown - -# Process notebooks using a Python script -python ./process_notebooks.py render - -# Start the website using yarn -yarn start