|
77 | 77 |
|
78 | 78 | # Load existing versions.json from deployed site or create empty |
79 | 79 | if [ -f "${{ github.workspace }}/docs/versions.json" ]; then |
80 | | - cp "${{ github.workspace }}/docs/versions.json" ./ |
81 | | - echo "✅ Loaded existing versions.json" |
| 80 | + # If we're building a specific version, exclude it from the imported versions.json |
| 81 | + if [ "${{ env.BUILDING_LATEST }}" != "true" ]; then |
| 82 | + # Filter out the version we're about to build |
| 83 | + node -e " |
| 84 | + const versions = JSON.parse(require('fs').readFileSync('${{ github.workspace }}/docs/versions.json', 'utf8')); |
| 85 | + const filtered = versions.filter(v => v !== '${{ env.VERSION_TAG }}'); |
| 86 | + require('fs').writeFileSync('versions.json', JSON.stringify(filtered, null, 2)); |
| 87 | + console.log('✅ Loaded versions.json (filtered out ${{ env.VERSION_TAG }})'); |
| 88 | + " |
| 89 | + else |
| 90 | + cp "${{ github.workspace }}/docs/versions.json" ./ |
| 91 | + echo "✅ Loaded existing versions.json" |
| 92 | + fi |
82 | 93 | else |
83 | 94 | echo "[]" > versions.json |
84 | 95 | echo "✅ Created empty versions.json" |
@@ -231,6 +242,16 @@ jobs: |
231 | 242 | # Generate API docs for current build |
232 | 243 | npm run gen-api-docs all |
233 | 244 |
|
| 245 | + # Patch out duplicate version badges from OpenAPI MDX files |
| 246 | + echo "🔧 Patching out duplicate version badges..." |
| 247 | + find . -name "llama-stack-specification.info.mdx" -type f -exec sed -i '/<span$/,/<\/span>$/d' {} \; |
| 248 | +
|
| 249 | + # Also patch versioned files if they exist |
| 250 | + if [ -d "versioned_docs" ]; then |
| 251 | + find versioned_docs -name "llama-stack-specification.info.mdx" -type f -exec sed -i '/<span$/,/<\/span>$/d' {} \; |
| 252 | + fi |
| 253 | + echo "✅ Version badge patching completed" |
| 254 | +
|
234 | 255 | # Build the site |
235 | 256 | npm run build |
236 | 257 |
|
|
0 commit comments