Skip to content

Commit 5f38a07

Browse files
Fix GitHub Pages deployment: Include API.docc, api.yaml, DocsExample, and build instructions
1 parent d2cf588 commit 5f38a07

File tree

2 files changed

+101
-7
lines changed

2 files changed

+101
-7
lines changed

.github/workflows/pages.yml

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

index.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@
516516
<nav>
517517
<ul>
518518
<li><a href="https://github.com/ayushshrivastv/OpenAPI-integration-with-DocC">GitHub</a></li>
519-
<li><a href="docs/documentation.html">Documentation</a></li>
519+
<li><a href="docs/index.html">Documentation</a></li>
520+
<li><a href="samples/DocsExample/index.html">Example</a></li>
520521
<li><a href="https://swift.org/documentation/docc/">DocC Resources</a></li>
521522
</ul>
522523
</nav>
@@ -535,7 +536,8 @@
535536
<div class="container">
536537
<h1>OpenAPI Integration with DocC</h1>
537538
<p>Transform OpenAPI specifications into beautiful, interactive documentation.</p>
538-
<a href="docs/documentation.html" class="btn">View Documentation</a>
539+
<a href="docs/index.html" class="btn">View Documentation</a>
540+
<a href="samples/DocsExample/index.html" class="btn">View Example</a>
539541
<a href="https://github.com/ayushshrivastv/OpenAPI-integration-with-DocC" class="btn btn-secondary">View on GitHub</a>
540542
<img src="docs/favicon.svg" alt="OpenAPI DocC graphic representation" class="hero-image" width="240">
541543
</div>
@@ -589,6 +591,18 @@ <h3>Auto-updating</h3>
589591
<p>Documentation stays in sync with your API as it evolves.</p>
590592
</div>
591593
</div>
594+
<div class="feature">
595+
<div class="feature-content">
596+
<div class="feature-icon">📄</div>
597+
<h3>Sample Files</h3>
598+
<p>Access the sample files needed to build documentation:</p>
599+
<ul style="text-align: left; margin-top: 10px;">
600+
<li><a href="samples/api.yaml">OpenAPI Specification</a></li>
601+
<li><a href="samples/API.docc">DocC Documentation Catalog</a></li>
602+
<li><a href="samples/README.md">Build Instructions</a></li>
603+
</ul>
604+
</div>
605+
</div>
592606
</div>
593607
</div>
594608
</section>
@@ -598,10 +612,11 @@ <h3>Auto-updating</h3>
598612
<img class="footer-logo" src="docs/favicon.svg" alt="OpenAPI DocC Logo" width="40">
599613
<div class="footer-links">
600614
<a href="https://github.com/ayushshrivastv/OpenAPI-integration-with-DocC">GitHub</a>
601-
<a href="docs/documentation.html">Documentation</a>
602-
<a href="https://swift.org/documentation/docc/">DocC Resources</a>
615+
<a href="docs/index.html">Documentation</a>
616+
<a href="samples/DocsExample/index.html">Example</a>
617+
<a href="samples/README.md">Build Instructions</a>
603618
</div>
604-
<p class="copyright">Copyright © 2024 OpenAPI Integration with DocC. All rights reserved. Built using Swift DocC and OpenAPI.</p>
619+
<p class="copyright">The DocsExample directory within the repository is the source for this example. Copyright © 2024 OpenAPI Integration with DocC. All rights reserved.</p>
605620
</div>
606621
</footer>
607622

0 commit comments

Comments
 (0)