Skip to content

Commit 7d391d4

Browse files
authored
Merge branch 'main' into letzya-patch-vale
2 parents 4de2fa5 + 8beea38 commit 7d391d4

File tree

256 files changed

+881
-1041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+881
-1041
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 97 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
subfolder:
7-
description: 'Subfolder for documentation (e.g., docs3, docsv3, docs)'
7+
description: 'Subfolder for documentation (leave empty for root deployment)'
88
required: false
9-
default: 'docs3'
9+
default: ''
1010
type: string
1111

1212
# Ensure only latest deployment runs
@@ -48,77 +48,68 @@ jobs:
4848
4949
- name: Cleanup old version folders and assets
5050
run: |
51-
echo "🧹 Cleaning up old version folders and assets..."
52-
53-
# Get current version folders from config
54-
current_folders=$(python3 -c "import json; config=json.load(open('branches-config.json')); folders=[v.get('folder','') for v in config.get('versions',[]) if v.get('folder','')]; print(' '.join(folders))")
55-
56-
echo "📋 Current version folders: $current_folders"
57-
58-
# Define asset types that will be regenerated
59-
asset_types=(
60-
"style.css"
61-
"images"
62-
"img"
63-
"logo"
64-
"favicon.ico"
65-
"favicon.png"
66-
"snippets"
51+
echo "🧹 Cleaning up all content except essential files..."
52+
53+
# Define folders to keep (whitelist)
54+
keep_folders=(
55+
".github"
56+
".git"
57+
".devcontainer"
58+
"scripts"
59+
".vale"
6760
)
6861
69-
# Remove old assets (they'll be regenerated from current versions)
70-
echo "🎨 Cleaning up old assets..."
71-
for asset in "${asset_types[@]}"; do
72-
if [ -e "$asset" ]; then
73-
echo "🗑️ Removing old asset: $asset"
74-
rm -rf "$asset"
75-
fi
76-
done
77-
78-
# Remove old docs.json (will be regenerated)
79-
if [ -f "docs.json" ]; then
80-
echo "🗑️ Removing old docs.json"
81-
rm -f "docs.json"
82-
fi
62+
# Define files to keep (whitelist)
63+
keep_files=(
64+
"branches-config.json"
65+
".gitignore"
66+
"README.md"
67+
".vale.ini"
68+
)
8369
84-
# Also clean up the subfolder if it exists (using input parameter)
85-
SUBFOLDER="${{ inputs.subfolder || 'docs3' }}"
86-
if [ -n "$SUBFOLDER" ] && [ -d "$SUBFOLDER" ]; then
87-
echo "🗑️ Removing old $SUBFOLDER subfolder"
88-
rm -rf "$SUBFOLDER"
89-
fi
70+
echo "📋 Folders to keep: ${keep_folders[*]}"
71+
echo "📋 Files to keep: ${keep_files[*]}"
9072
91-
# Remove old version folders that aren't in the current config
92-
# Look for directories that look like version folders (numeric or version-like names)
73+
# Remove all directories except the ones we want to keep
74+
echo "🗑️ Removing old directories..."
9375
for dir in */; do
9476
if [ -d "$dir" ]; then
9577
dir_name=${dir%/} # Remove trailing slash
96-
97-
# Skip non-version directories
98-
if [[ "$dir_name" =~ ^\..*$ ]] || [ "$dir_name" = ".github" ]; then
99-
continue
100-
fi
101-
102-
# Check if this folder is in current config
103-
is_current=false
104-
for current in $current_folders; do
105-
if [ "$dir_name" = "$current" ]; then
106-
is_current=true
78+
79+
should_keep=false
80+
for keep_folder in "${keep_folders[@]}"; do
81+
if [ "$dir_name" = "$keep_folder" ]; then
82+
should_keep=true
10783
break
10884
fi
10985
done
86+
87+
if [ "$should_keep" = false ]; then
88+
echo "🗑️ Removing directory: $dir_name/"
89+
rm -rf "$dir"
90+
else
91+
echo "📁 Keeping essential directory: $dir_name/"
92+
fi
93+
fi
94+
done
11095
111-
# If it's not in current config and looks like a version folder, remove it
112-
if [ "$is_current" = false ]; then
113-
# Only remove if it looks like a version folder (contains numbers/dots or common version patterns)
114-
if [[ "$dir_name" =~ ^[0-9]+\.[0-9]+$ ]] || [[ "$dir_name" =~ ^v[0-9] ]] || [[ "$dir_name" =~ ^[0-9] ]]; then
115-
echo "🗑️ Removing old version folder: $dir_name"
116-
rm -rf "$dir"
117-
else
118-
echo "📁 Keeping non-version directory: $dir_name"
96+
# Remove all files except the ones we want to keep
97+
echo "🗑️ Removing old files..."
98+
for file in *; do
99+
if [ -f "$file" ]; then
100+
should_keep=false
101+
for keep_file in "${keep_files[@]}"; do
102+
if [ "$file" = "$keep_file" ]; then
103+
should_keep=true
104+
break
119105
fi
106+
done
107+
108+
if [ "$should_keep" = false ]; then
109+
echo "🗑️ Removing file: $file"
110+
rm -f "$file"
120111
else
121-
echo "📁 Keeping current version folder: $dir_name (will be refreshed)"
112+
echo "📄 Keeping essential file: $file"
122113
fi
123114
fi
124115
done
@@ -134,7 +125,7 @@ jobs:
134125
echo "🔄 Starting branch cloning and organization..."
135126
136127
# Read the branches config and extract branch information
137-
branches=$(python3 -c "import json; config=json.load(open('branches-config.json')); [print(f\"{v.get('folder','')}:{v.get('branch','main')}\") for v in config.get('versions',[]) if v.get('folder','')]")
128+
branches=$(python3 -c "import json; config=json.load(open('branches-config.json')); [print(f\"{v.get('sourceFolder','')}:{v.get('branch','main')}\") for v in config.get('versions',[]) if v.get('sourceFolder','')]")
138129
139130
echo "📋 Branches to process:"
140131
echo "$branches"
@@ -194,18 +185,20 @@ jobs:
194185
run: |
195186
echo "🔄 Running documentation merger..."
196187
197-
# Get subfolder from input (with fallback)
198-
SUBFOLDER="${{ inputs.subfolder || 'docs3' }}"
199-
echo "📁 Using subfolder: $SUBFOLDER"
188+
# Get subfolder from input (no fallback - empty means root deployment)
189+
SUBFOLDER="${{ inputs.subfolder }}"
190+
echo "📁 Using subfolder: '$SUBFOLDER'"
200191
201192
# Run the merge script with branches config
202193
if [ -n "$SUBFOLDER" ]; then
194+
echo "📁 Deploying to subfolder: $SUBFOLDER"
203195
python3 scripts/merge_docs_configs.py \
204196
--branches-config branches-config.json \
205197
--base-dir . \
206198
--subfolder "$SUBFOLDER" \
207199
--output docs.json
208200
else
201+
echo "📁 Deploying to root (no subfolder)"
209202
python3 scripts/merge_docs_configs.py \
210203
--branches-config branches-config.json \
211204
--base-dir . \
@@ -219,7 +212,7 @@ jobs:
219212
echo "🧹 Cleaning up temporary cloned version folders..."
220213
221214
# Get current version folders from config
222-
current_folders=$(python3 -c "import json; config=json.load(open('branches-config.json')); folders=[v.get('folder','') for v in config.get('versions',[]) if v.get('folder','')]; print(' '.join(folders))")
215+
current_folders=$(python3 -c "import json; config=json.load(open('branches-config.json')); folders=[v.get('sourceFolder','') for v in config.get('versions',[]) if v.get('sourceFolder','')]; print(' '.join(folders))")
223216
224217
echo "📋 Removing cloned folders: $current_folders"
225218
@@ -251,6 +244,36 @@ jobs:
251244
echo "📁 Generated file structure:"
252245
find . -name "*.mdx" -o -name "*.md" -o -name "*.json" -o -name "*.css" -o -name "*.png" | head -20
253246
247+
- name: Close previous deployment PRs
248+
run: |
249+
echo "🔍 Finding and closing previous deployment PRs..."
250+
251+
# Find PRs that match BOTH criteria:
252+
# 1. Have the "auto-deployment" label
253+
# 2. Branch starts with "docs-merge-"
254+
DEPLOYMENT_PRS=$(gh pr list \
255+
--state open \
256+
--label "auto-deployment" \
257+
--json number,headRefName,labels \
258+
--jq '.[] | select(.headRefName | startswith("docs-merge-")) | .number')
259+
260+
if [ -n "$DEPLOYMENT_PRS" ]; then
261+
echo "📋 Found deployment PRs to close: $DEPLOYMENT_PRS"
262+
263+
for pr_number in $DEPLOYMENT_PRS; do
264+
echo "❌ Closing deployment PR #$pr_number"
265+
gh pr close "$pr_number" \
266+
--comment "🤖 Superseded by newer deployment (Run #${{ github.run_number }})" \
267+
|| echo "⚠️ Failed to close PR #$pr_number (may already be closed)"
268+
done
269+
270+
echo "✅ Closed all previous deployment PRs"
271+
else
272+
echo "✅ No deployment PRs found to close"
273+
fi
274+
env:
275+
GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }}
276+
254277
- name: Create Pull Request
255278
id: create-pr
256279
uses: peter-evans/create-pull-request@v7
@@ -267,19 +290,23 @@ jobs:
267290
**Generated from:** `branches-config.json`
268291
**Timestamp:** ${{ github.event.head_commit.timestamp }}
269292
**Run ID:** ${{ github.run_id }}
293+
**Subfolder:** `${{ inputs.subfolder || '(root deployment)' }}`
270294
271295
### Changes Include:
272296
- ✅ Merged documentation from multiple branches
273297
- ✅ Generated unified `docs.json` configuration
274298
- ✅ Updated assets and content structure
275299
- ✅ Cleaned up outdated version folders
276300
277-
### Subfolder Used:
278-
`${{ inputs.subfolder || 'docs3' }}`
279-
280301
---
281302
282-
Please review the changes and merge when ready.
303+
🚦 **This PR will be processed by merge queue to ensure proper validation and ordering.**
304+
305+
Previous deployment PRs have been automatically closed to prevent conflicts.
306+
labels: |
307+
documentation
308+
auto-deployment
309+
automated
283310
commit-message: |
284311
🤖 Auto-merge documentation from branches
285312
@@ -298,7 +325,7 @@ jobs:
298325
if: steps.create-pr.outputs.pull-request-number
299326
run: |
300327
PR_NUMBER="${{ steps.create-pr.outputs.pull-request-number }}"
301-
echo "🔄 Enabling auto-merge on deployment PR #$PR_NUMBER..."
328+
echo " Enabling auto-merge on deployment PR #$PR_NUMBER..."
302329
303330
gh pr merge --squash --auto "$PR_NUMBER"
304331

.github/workflows/trigger-docs-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
-H "Authorization: token ${{ secrets.ORG_GH_TOKEN }}" \
1717
-H "Accept: application/vnd.github.v3+json" \
1818
https://api.github.com/repos/${{ github.repository }}/actions/workflows/deploy-docs.yml/dispatches \
19-
-d '{"ref": "production", "inputs": {"subfolder": "docs3"}}'
19+
-d '{"ref": "production"}'

advanced-configuration/other-protocols.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Advanced Communication Protocols"
3-
description: "How to configure advanced communication protocols"
3+
'og:description': "How to configure advanced communication protocols"
44
sidebarTitle: "Overview"
55
tags: ['gRPC', 'SSE', 'Websocket', 'Other Protocol']
66
---

advanced-configuration/sse-proxy.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Server Side Events Proxy"
3-
description: "Describe how you can use Tyk as a simple Server Side Events Proxy"
3+
'og:description': "Describe how you can use Tyk as a simple Server Side Events Proxy"
44
sidebarTitle: "Server Side Events"
55
tags: ['SSE Proxy', 'Other Protocol']
66
---

advanced-configuration/transform-traffic/soap-rest.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Transformation Use Case: SOAP To REST"
3-
description: "How to transform SOAP API to REST API in Tyk"
3+
'og:description': "How to transform SOAP API to REST API in Tyk"
44
sidebarTitle: "SOAP To REST"
55
tags: ['Traffic Transformation', 'SOAP', 'REST', 'SOAP to REST']
66
---

advanced-configuration/websockets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Websockets"
3-
description: "How to use websockets in Tyk"
3+
'og:description': "How to use websockets in Tyk"
44
sidebarTitle: "Websockets"
55
tags: ['websockets', 'Other Protocol']
66
---

ai-management/ai-studio/ai-portal.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "AI Portal"
3-
description: "How AI Portal works?"
3+
'og:description': "How AI Portal works?"
44
sidebarTitle: "AI Portal"
55
tags: ['AI Studio', 'AI Management', 'AI Portal']
66
---

ai-management/ai-studio/ai-studio-swagger.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Tyk AI Studio API"
3-
description: "Tyk AI Studio API"
3+
'og:description': "Tyk AI Studio API"
44
sidebarTitle: "API Documentation"
55
tags: ['OpenAPI Spec for AI Studio', 'Tyk AI Studio OAS', 'Tyk AI Portal REST']
66
---

ai-management/ai-studio/analytics.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Analytics & Monitoring"
3-
description: "How to configure analytics in Tyk AI Studio?"
3+
'og:description': "How to configure analytics in Tyk AI Studio?"
44
sidebarTitle: "Analytics & Monitoring"
55
tags: ['AI Studio', 'AI Management', 'Analytics', 'Monitoring']
66
---

ai-management/ai-studio/apps.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Apps View for Tyk AI Studio"
3-
description: "How to configure apps in AI Studio?"
3+
'og:description': "How to configure apps in AI Studio?"
44
sidebarTitle: "Apps View for Tyk AI Studio"
55
tags: ['AI Studio', 'AI Management', 'Apps']
66
---

0 commit comments

Comments
 (0)