@@ -23,12 +23,91 @@ jobs:
2323 steps :
2424 - name : Checkout
2525 uses : actions/checkout@v4
26+
2627 - name : Setup Pages
2728 uses : actions/configure-pages@v5
29+
30+ - name : Prepare public directory
31+ run : |
32+ # Create public directory
33+ mkdir -p public
34+
35+ # Copy documentation files
36+ cp -r docs/* public/
37+
38+ # Copy sample files and make them accessible
39+ cp -r DocsExample public/
40+ cp api.yaml public/
41+ cp -r API.docc public/
42+
43+ # Create README with instructions and note about source
44+ cat > public/README.md << 'EOF'
45+ # The DocsExample directory within the repository (ayushshrivastv/OpenAPI-integration-with-DocC/DocsExample) is the source for this example.
46+
47+ ## Building and Viewing Documentation Locally
48+
49+ 1. Convert OpenAPI specification to SymbolGraph:
50+ ```
51+ swift run openapi-to-symbolgraph api.yaml --output-path api.symbolgraph.json
52+ ```
53+
54+ 2. Generate DocC documentation:
55+ ```
56+ xcrun docc convert API.docc --fallback-display-name API --fallback-bundle-identifier com.example.API --fallback-bundle-version 1.0.0 --additional-symbol-graph-dir ./ --output-path ./docs
57+ ```
58+
59+ 3. View the documentation locally:
60+ ```
61+ python -m http.server 8000 --directory docs
62+ ```
63+
64+ 4. Open your browser to http://localhost:8000
65+ EOF
66+
67+ # Create a simple index page if one doesn't exist
68+ if [ ! -f public/index.html ]; then
69+ cat > public/index.html << 'EOF'
70+ <!DOCTYPE html>
71+ <html lang="en">
72+ <head>
73+ <meta charset="UTF-8">
74+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
75+ <title>OpenAPI Integration with DocC</title>
76+ <style>
77+ body { font-family: -apple-system, sans-serif; line-height: 1.6; max-width: 800px; margin: 0 auto; padding: 20px; }
78+ h1, h2 { color: #0066cc; }
79+ .card { background: #f5f5f7; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
80+ a { color: #0066cc; text-decoration: none; }
81+ a:hover { text-decoration: underline; }
82+ </style>
83+ </head>
84+ <body>
85+ <h1>OpenAPI Integration with DocC</h1>
86+ <p>Tools and examples for integrating OpenAPI specifications with Apple's DocC documentation system.</p>
87+
88+ <div class="card">
89+ <h2>Sample Files</h2>
90+ <p>The DocsExample directory within the repository (ayushshrivastv/OpenAPI-integration-with-DocC/DocsExample) is the source for this example.</p>
91+ <ul>
92+ <li><a href="./DocsExample/index.html">View Example Documentation</a></li>
93+ <li><a href="./api.yaml">OpenAPI Specification (api.yaml)</a></li>
94+ <li><a href="./API.docc">DocC Documentation Catalog (API.docc)</a></li>
95+ <li><a href="./README.md">Build Instructions</a></li>
96+ </ul>
97+ </div>
98+ </body>
99+ </html>
100+ EOF
101+ else
102+ # If there's an existing index.html, add a note about the location of examples
103+ sed -i 's/<\/body>/<div style="margin-top: 20px; padding: 10px; background: #f0f0f0; border-radius: 5px;"><p>The DocsExample directory within the repository (ayushshrivastv\/OpenAPI-integration-with-DocC\/DocsExample) is the source for this example.<\/p><p>Sample files are available: <a href="\/DocsExample">DocsExample<\/a>, <a href="\/api.yaml">api.yaml<\/a>, <a href="\/API.docc">API.docc<\/a>, <a href="\/README.md">README.md<\/a><\/p><\/div><\/body>/g' public/index.html || true
104+ fi
105+
28106 - name : Upload artifact
29107 uses : actions/upload-pages-artifact@v3
30108 with :
31- path : ' ./docs'
109+ path : ' ./public'
110+
32111 - name : Deploy to GitHub Pages
33112 id : deployment
34- uses : actions/deploy-pages@v4
113+ uses : actions/deploy-pages@v4
0 commit comments