Skip to content
Snippets Groups Projects
Commit 35274af0 authored by Carlos Gauci's avatar Carlos Gauci
Browse files

chore: update docs generation

parent 3d744b63
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ name: Release Docs ...@@ -3,6 +3,7 @@ name: Release Docs
on: on:
release: release:
types: [ released ] types: [ released ]
workflow_dispatch:
jobs: jobs:
build-docs: build-docs:
...@@ -37,21 +38,73 @@ jobs: ...@@ -37,21 +38,73 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
poetry install --all-extras poetry install --all-extras
- name: Build docs - name: Build docs
run: | run: |
poetry run sphinx-build -M html docs/source docs/build mkdir -p docs/build
- name: Authenticate to Google Cloud poetry run pydoc-markdown .pydoc-markdown.yml
id: auth
uses: google-github-actions/auth@v2 - name: Checkout docs repo
uses: actions/checkout@v4
with: with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} repository: aurelio-labs/docs
- name: Upload Docs path: temp-docs
token: ${{ secrets.DOCS_PAT }}
- name: Copy and rename docs
run: |
ROOT_DIR=$(pwd)
rm -rf temp-docs/semantic-router/client-reference
mkdir -p temp-docs/semantic-router/client-reference/
# Find and copy all md files
cd docs/build/semantic_router
find . -type f -name "*.md" | while read file; do
dir=$(dirname "$file")
echo "Processing file: $file in directory: $dir"
mkdir -p "$ROOT_DIR/temp-docs/semantic-router/client-reference/$dir"
cp "$file" "$ROOT_DIR/temp-docs/semantic-router/client-reference/${file%.md}.mdx"
done
- name: Update frontmatter keys
run: |
find temp-docs/semantic-router/client-reference -type f -name "*.mdx" -exec sed -i 's/sidebar_label:/sidebarTitle:/g' {} +
- name: Install jq
run: sudo apt-get install -y jq
- name: Update mintlify docs.json navigation
run: |
# Get files and create grouped structure using jq
files=$(cd temp-docs/semantic-router/client-reference && find . -type f -name "*.mdx" | sed 's|^./||' | sed 's|.mdx$||' | sort | jq -R -s '
split("\n")[:-1]
| map("semantic-router/client-reference/" + .)
| reduce .[] as $path (
{"root": [], "groups": {}};
if ($path | split("/") | length) == 4 then
.groups[$path | split("/")[2]] += [$path]
else
.root += [$path]
end
)
| [.root[], (.groups | to_entries | map({
"group": .key,
"pages": .value
}))[]
]
')
# Update the docs.json file
jq --arg pages "$files" '
(.navigation.tabs[] | select(.tab == "Semantic Router") |
.groups[] | select(.group == "Client Reference") |
.pages) |= ($pages | fromjson)
' temp-docs/docs.json > temp-docs/docs.json.tmp && mv temp-docs/docs.json.tmp temp-docs/docs.json
- name: Commit and push changes
working-directory: temp-docs
run: | run: |
gcloud storage rsync docs/build/html gs://docs-bucket-production/semantic-router --recursive --delete-unmatched-destination-objects git config --local user.email "github-actions[bot]@users.noreply.github.com"
# - name: Upload Docs git config --local user.name "github-actions[bot]"
# id: upload-directory git add .
# uses: google-github-actions/upload-cloud-storage@v2 git diff --quiet && git diff --staged --quiet || (git commit -m "Update Semantic Router documentation" && git push)
# with: \ No newline at end of file
# path: docs/build/html
# destination: docs-bucket-production/semantic-router
# parent: false
loaders:
- type: python
packages:
- semantic_router
search_path: ["."]
processors:
- type: filter
skip_empty_modules: true
exclude_private: true
exclude_special: true
documented_only: true
do_not_filter_modules: true
- type: smart
- type: crossref
renderer:
type: docusaurus
docs_base_path: docs/build
relative_output_path: .
\ No newline at end of file
This diff is collapsed.
...@@ -39,6 +39,7 @@ psycopg2-binary = {version = "^2.9.9", optional = true} ...@@ -39,6 +39,7 @@ psycopg2-binary = {version = "^2.9.9", optional = true}
sphinx = {version = "^7.0.0", optional = true} sphinx = {version = "^7.0.0", optional = true}
sphinxawesome-theme = {version = "^5.2.0", optional = true} sphinxawesome-theme = {version = "^5.2.0", optional = true}
tornado = {version = "^6.4.2", optional = true} tornado = {version = "^6.4.2", optional = true}
urllib3 = ">=1.25.4,<1.27"
[tool.poetry.extras] [tool.poetry.extras]
hybrid = ["pinecone-text"] hybrid = ["pinecone-text"]
...@@ -66,6 +67,7 @@ mypy = "^1.7.1" ...@@ -66,6 +67,7 @@ mypy = "^1.7.1"
types-pyyaml = "^6.0.12.12" types-pyyaml = "^6.0.12.12"
types-requests = "^2.31.0" types-requests = "^2.31.0"
black = {extras = ["jupyter"], version = ">=23.12.1,<24.5.0"} black = {extras = ["jupyter"], version = ">=23.12.1,<24.5.0"}
pydoc-markdown="^4.8.2"
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment