Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,68 +414,4 @@ jobs:
console.log('❌ Failed to post documentation comment:', error.message);
}

# ============================================================================
# Deploy to GitHub Pages (only on main branch)
# ============================================================================

deploy-pages:
name: "Deploy to GitHub Pages"
runs-on: ubuntu-latest
needs: build-docs
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: api-documentation
path: docs/api/

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Prepare docs for deployment
run: |
echo "🔧 Preparing documentation for GitHub Pages deployment..."

# Ensure proper file permissions
find docs/ -type f -exec chmod 644 {} \;
find docs/ -type d -exec chmod 755 {} \;

# Create .nojekyll to prevent Jekyll processing of certain files
touch docs/.nojekyll

# Update main docs index to include API documentation link
if [ -f "docs/index.html" ]; then
# Check if API link already exists
if ! grep -q "api/" docs/index.html; then
echo "Adding API documentation link to main docs"
# This would need to be customized based on your docs/index.html structure
fi
fi

echo "📁 Final documentation structure:"
find docs/ -type f | head -20
echo "..."

- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: docs/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Update deployment status
run: |
echo "🚀 Documentation deployed successfully!"
echo "📍 Available at: ${{ steps.deployment.outputs.page_url }}"
echo "🔗 API Docs: ${{ steps.deployment.outputs.page_url }}api/"
72 changes: 61 additions & 11 deletions .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Deploy GitHub Pages

on:
# Trigger on successful CI completion OR performance baseline completion
# Trigger on successful CI completion OR performance baseline completion OR documentation
workflow_run:
workflows: ["CI/CD Pipeline", "Performance Baseline Tracking"]
workflows: ["CI/CD Pipeline", "Performance Baseline Tracking", "Documentation"]
branches: [main, master]
types:
- completed
Expand Down Expand Up @@ -95,6 +95,8 @@ jobs:
foundDocs = await downloadArtifact(currentRunId, "docs-for-pages", "docs.zip");
} else if ('${{ github.event.workflow_run.name }}' === 'Performance Baseline Tracking') {
foundDocs = await downloadArtifact(currentRunId, "performance-docs-for-pages", "perf-docs.zip");
} else if ('${{ github.event.workflow_run.name }}' === 'Documentation') {
foundDocs = await downloadArtifact(currentRunId, "api-documentation", "api-docs.zip");
}

// If this is a CI run, also look for recent Performance Baseline artifacts
Expand Down Expand Up @@ -139,6 +141,28 @@ jobs:
new Date(run.created_at) > new Date(Date.now() - 24 * 60 * 60 * 1000) // Within 24 hours
);

if (recentCIRun) {
console.log(`📋 Found recent CI run: ${recentCIRun.id}`);
await downloadArtifact(recentCIRun.id, "docs-for-pages", "ci-docs.zip");
}
} else if ('${{ github.event.workflow_run.name }}' === 'Documentation') {
console.log('📚 Documentation workflow triggered - looking for CI docs...');

// Get recent CI workflow runs for base documentation
const workflowRuns = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'ci.yml',
branch: 'main',
status: 'completed',
per_page: 5
});

const recentCIRun = workflowRuns.data.workflow_runs.find(run =>
run.conclusion === 'success' &&
new Date(run.created_at) > new Date(Date.now() - 24 * 60 * 60 * 1000) // Within 24 hours
);

if (recentCIRun) {
console.log(`📋 Found recent CI run: ${recentCIRun.id}`);
await downloadArtifact(recentCIRun.id, "docs-for-pages", "ci-docs.zip");
Expand All @@ -154,15 +178,15 @@ jobs:
run: |
# Remove any existing docs directory to avoid conflicts
rm -rf docs/

echo "🔧 Extracting documentation artifacts..."

# Create base docs structure from repository
mkdir -p docs/performance

mkdir -p docs/performance docs/api
# Copy base documentation from repository
cp -r /tmp/repo-docs/* docs/ 2>/dev/null || echo "No base docs found in repo"

# Extract CI docs first (base documentation)
if [ -f "docs.zip" ]; then
echo "📋 Extracting CI documentation..."
Expand All @@ -178,7 +202,7 @@ jobs:
rm -rf temp-docs/
echo "✅ CI docs extracted"
fi

# Extract performance docs second (will overlay/merge with CI docs)
if [ -f "perf-docs.zip" ]; then
echo "🔥 Extracting performance documentation..."
Expand All @@ -190,7 +214,29 @@ jobs:
rm -rf temp-perf/
echo "✅ Performance docs extracted and merged"
fi


# Extract API documentation third (will overlay/merge with existing docs)
if [ -f "api-docs.zip" ]; then
echo "📚 Extracting API documentation..."
unzip -o api-docs.zip -d temp-api/
# The artifact contains docs/api/ structure, so extract into docs/
if [ -d "temp-api/docs/api" ]; then
echo "Found docs/api structure in artifact"
rsync -a temp-api/docs/api/ docs/api/
elif [ -d "temp-api/api" ]; then
echo "Found api/ structure in artifact"
rsync -a temp-api/api/ docs/api/
else
# Fallback: copy everything to api directory
echo "⚠️ Unexpected artifact structure - using fallback"
echo "Artifact contents:"
find temp-api/ -type d | head -10
rsync -a temp-api/ docs/api/
fi
rm -rf temp-api/
echo "✅ API docs extracted and merged"
fi

# Ensure performance directory exists with minimum required files
mkdir -p docs/performance
if [ ! -f "docs/performance/index.html" ]; then
Expand All @@ -199,14 +245,18 @@ jobs:
cp /tmp/repo-docs/performance/index.html docs/performance/
fi
fi

echo ""
echo "📁 Final merged documentation structure:"
find docs/ -type f | sort

echo ""
echo "🔍 Performance files check:"
ls -la docs/performance/ 2>/dev/null || echo "❌ No performance directory found"

echo ""
echo "🔍 API docs check:"
ls -la docs/api/ 2>/dev/null || echo "❌ No API directory found"

- name: Prepare Jekyll site for Pages deployment
run: |
Expand Down
Loading