Unverified Commit 948d6d85 authored by Neal Vaidya's avatar Neal Vaidya Committed by GitHub
Browse files

fix: update docs version syncing (#6197)


Signed-off-by: default avatarNeal Vaidya <nealv@nvidia.com>
parent cd6984b9
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# - Triggers on pull requests when docs/** files change # - Triggers on pull requests when docs/** files change
# - Runs `fern check` and `fern docs broken-links` # - Runs `fern check` and `fern docs broken-links`
# #
# 2. SYNC vNEXT (push to main): Syncs docs/ from main to docs-website branch # 2. SYNC dev (push to main): Syncs docs/ from main to docs-website branch
# - Triggers on push to main when docs/** files change # - Triggers on push to main when docs/** files change
# - Preserves versioned documentation snapshots on docs-website branch # - Preserves versioned documentation snapshots on docs-website branch
# - Publishes docs to Fern after syncing # - Publishes docs to Fern after syncing
...@@ -49,7 +49,7 @@ on: ...@@ -49,7 +49,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: tag:
description: 'Version tag to release (e.g., v0.9.0). Leave empty to sync vNext.' description: 'Version tag to release (e.g., v0.9.0). Leave empty to sync dev docs.'
required: false required: false
type: string type: string
...@@ -138,11 +138,11 @@ jobs: ...@@ -138,11 +138,11 @@ jobs:
run: fern docs broken-links run: fern docs broken-links
############################################################################# #############################################################################
# SYNC vNEXT - Run on push to main when docs/** files change # SYNC dev - Run on push to main when docs/** files change
############################################################################# #############################################################################
sync-vnext: sync-dev:
name: Sync vNext to docs-website name: Sync dev to docs-website
needs: changed-files needs: changed-files
if: | if: |
github.ref == 'refs/heads/main' && github.ref == 'refs/heads/main' &&
...@@ -171,16 +171,16 @@ jobs: ...@@ -171,16 +171,16 @@ jobs:
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync vNext content from main - name: Sync dev content from main
run: | run: |
# Sync pages/ directory (vNext content) # Sync pages/ directory (dev content)
echo "Syncing pages/ from main to docs-website branch..." echo "Syncing pages/ from main to docs-website branch..."
rm -rf docs-checkout/docs/pages rm -rf docs-checkout/docs/pages
cp -r main-checkout/docs/pages docs-checkout/docs/pages cp -r main-checkout/docs/pages docs-checkout/docs/pages
# Sync versions/next.yml (vNext navigation) # Sync versions/dev.yml (dev navigation)
echo "Syncing versions/next.yml from main to docs-website branch..." echo "Syncing versions/dev.yml from main to docs-website branch..."
cp main-checkout/docs/versions/next.yml docs-checkout/docs/versions/next.yml cp main-checkout/docs/versions/dev.yml docs-checkout/docs/versions/dev.yml
# Sync assets/ directory # Sync assets/ directory
echo "Syncing assets/ from main to docs-website branch..." echo "Syncing assets/ from main to docs-website branch..."
...@@ -201,6 +201,19 @@ jobs: ...@@ -201,6 +201,19 @@ jobs:
cp main-checkout/docs/convert_callouts.py docs-checkout/docs/convert_callouts.py cp main-checkout/docs/convert_callouts.py docs-checkout/docs/convert_callouts.py
fi fi
# Sync components/ directory (e.g., CustomFooter.tsx)
if [ -d main-checkout/docs/components ]; then
echo "Syncing components/ from main to docs-website branch..."
rm -rf docs-checkout/docs/components
cp -r main-checkout/docs/components docs-checkout/docs/components
fi
# Sync main.css
if [ -f main-checkout/docs/main.css ]; then
echo "Syncing main.css from main to docs-website branch..."
cp main-checkout/docs/main.css docs-checkout/docs/main.css
fi
- name: Convert GitHub callouts to Fern format - name: Convert GitHub callouts to Fern format
run: | run: |
echo "Converting GitHub-style callouts to Fern format in pages/..." echo "Converting GitHub-style callouts to Fern format in pages/..."
...@@ -211,27 +224,17 @@ jobs: ...@@ -211,27 +224,17 @@ jobs:
run: | run: |
cd docs-checkout/docs cd docs-checkout/docs
# Extract the list of versioned entries from current docs.yml (on docs-website branch) # Save the full versions array from docs-website
# These are entries after "path: ./versions/next.yml" yq '.products[0].versions' docs.yml > /tmp/preserved_versions.yml
# We need to preserve them while updating the rest from main
# Get version entries (lines containing "display-name: v" and their path lines) echo "Preserved versions array:"
VERSION_ENTRIES=$(awk '/- display-name: v/{found=1} found{print; if(/path:/) found=0}' docs.yml) cat /tmp/preserved_versions.yml
# Copy docs.yml from main as base # Copy docs.yml from main to get config updates
cp ../../main-checkout/docs/docs.yml docs.yml cp ../../main-checkout/docs/docs.yml docs.yml
# If we had version entries, append them after the next.yml line # Restore the preserved versions array
if [ -n "$VERSION_ENTRIES" ]; then yq -i '.products[0].versions = load("/tmp/preserved_versions.yml")' docs.yml
echo "Preserving version entries:"
echo "$VERSION_ENTRIES"
# Create a temp file with the version entries properly indented
echo "$VERSION_ENTRIES" > /tmp/version_entries.txt
# Insert version entries after the next.yml path line
sed -i '/path: \.\/versions\/next\.yml/r /tmp/version_entries.txt' docs.yml
fi
echo "Updated docs.yml:" echo "Updated docs.yml:"
cat docs.yml cat docs.yml
...@@ -255,7 +258,7 @@ jobs: ...@@ -255,7 +258,7 @@ jobs:
cd docs-checkout cd docs-checkout
git add -A git add -A
git commit -m "docs(fern): sync vNext from main git commit -m "docs(fern): sync dev from main
Automated sync of docs/ directory from main branch. Automated sync of docs/ directory from main branch.
Preserves versioned documentation snapshots. Preserves versioned documentation snapshots.
...@@ -264,7 +267,7 @@ jobs: ...@@ -264,7 +267,7 @@ jobs:
git push origin docs-website git push origin docs-website
echo "Successfully synced vNext docs to docs-website branch" echo "Successfully synced dev docs to docs-website branch"
- name: Setup Node.js - name: Setup Node.js
if: steps.changes.outputs.has_changes == 'true' if: steps.changes.outputs.has_changes == 'true'
...@@ -402,8 +405,8 @@ jobs: ...@@ -402,8 +405,8 @@ jobs:
echo "Creating version config: $VERSION_FILE" echo "Creating version config: $VERSION_FILE"
# Copy next.yml as template # Copy dev.yml as template
cp docs/versions/next.yml "$VERSION_FILE" cp docs/versions/dev.yml "$VERSION_FILE"
# Update the comment at the top # Update the comment at the top
sed -i "s/# Navigation structure for Latest version/# Navigation structure for $TAG version/" "$VERSION_FILE" sed -i "s/# Navigation structure for Latest version/# Navigation structure for $TAG version/" "$VERSION_FILE"
...@@ -424,26 +427,32 @@ jobs: ...@@ -424,26 +427,32 @@ jobs:
echo "Updating $DOCS_FILE to include $TAG..." echo "Updating $DOCS_FILE to include $TAG..."
# Check if version already in docs.yml # Check if version already in docs.yml
if grep -q "display-name: $TAG" "$DOCS_FILE"; then if yq ".products[0].versions[] | select(.display-name == \"$TAG\")" "$DOCS_FILE" | grep -q .; then
echo "Version $TAG already in docs.yml, skipping update" echo "Version $TAG already in docs.yml, skipping update"
exit 0 exit 0
fi fi
# Insert new version after "Next" entry # Find the index of the "dev" entry and insert new version right after it
# The new version should be inserted after the "path: ./versions/next.yml" line DEV_IDX=$(yq '.products[0].versions | to_entries | map(select(.value.display-name == "dev")) | .[0].key' "$DOCS_FILE")
# Use a temp file approach for reliable multi-line insertion INSERT_IDX=$((DEV_IDX + 1))
awk -v tag="$TAG" '
/path: \.\/versions\/next\.yml/ { yq -i "
print .products[0].versions |= (
print " - display-name: " tag .[:$INSERT_IDX] +
print " path: ./versions/" tag ".yml" [{\"display-name\": \"$TAG\", \"path\": \"./versions/$TAG.yml\", \"slug\": \"$TAG\", \"availability\": \"stable\"}] +
next .[$INSERT_IDX:]
} )
{ print } " "$DOCS_FILE"
' "$DOCS_FILE" > "${DOCS_FILE}.tmp" && mv "${DOCS_FILE}.tmp" "$DOCS_FILE"
# Update the top-level entry to point to the new version
echo "Updated docs.yml versions section:" yq -i ".products[0].path = \"./versions/$TAG.yml\"" "$DOCS_FILE"
grep -A 20 "^versions:" "$DOCS_FILE"
# Update the "Latest" entry to point to the new version
yq -i ".products[0].versions[0].path = \"./versions/$TAG.yml\"" "$DOCS_FILE"
yq -i ".products[0].versions[0].display-name = \"Latest ($TAG)\"" "$DOCS_FILE"
echo "Updated docs.yml products/versions section:"
yq '.products[0].versions' "$DOCS_FILE"
- name: Commit and push changes - name: Commit and push changes
run: | run: |
......
...@@ -24,10 +24,10 @@ title: NVIDIA Dynamo Documentation ...@@ -24,10 +24,10 @@ title: NVIDIA Dynamo Documentation
products: products:
- display-name: Dynamo - display-name: Dynamo
slug: / slug: /
path: ./versions/next.yml path: ./versions/dev.yml
versions: versions:
- display-name: Next - display-name: dev
path: ./versions/next.yml path: ./versions/dev.yml
# GitHub repository link in navbar # GitHub repository link in navbar
navbar-links: navbar-links:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment