1- name : ' Deploy DocC Documentation'
2- description : ' Build and deploy Swift DocC documentation with versioning support'
1+ name : ' Build DocC Documentation'
2+ description : ' Build Swift DocC documentation with versioning support'
33author : ' Nikita Vasilev'
44
55inputs :
66 schemes :
77 description : ' JSON array of schemes to build (e.g. ["MyLib", "MyUI"])'
88 required : true
99 version :
10- description : ' Documentation version (e.g. "1.0.0", "latest") '
10+ description : ' Documentation version'
1111 required : false
1212 default : ' latest'
1313 xcode-version :
14- description : ' Xcode version to use '
14+ description : ' Xcode version'
1515 required : false
1616 default : ' latest-stable'
17- project-name :
18- description : ' Project display name (defaults to repo name)'
19- required : false
20- default : ' '
21- # template-repo:
22- # description: 'Repository containing index template (owner/repo)'
23- # required: false
24- # default: ''
25- # template-path:
26- # description: 'Path to index.html template in template repo'
27- # required: false
28- # default: 'templates/default/index.html'
29- project-description :
30- description : ' Project description for index page'
31- required : false
32- default : ' Comprehensive documentation for Swift framework'
3317 keep-old-versions :
34- description : ' Keep old documentation versions'
35- required : false
36- default : ' true'
37- github-token :
38- description : ' GitHub token for deployment'
39- required : true
40- deploy :
41- description : ' Deploy to GitHub Pages (true/false)'
18+ description : ' Keep old versions in docs/'
4219 required : false
4320 default : ' true'
4421
4522outputs :
4623 docs-path :
47- description : ' Path to generated documentation '
24+ description : ' Path to the generated docs folder '
4825 value : ${{ steps.build.outputs.docs_path }}
4926 version :
50- description : ' Documentation version that was built '
27+ description : ' Version used for build '
5128 value : ${{ steps.parse.outputs.version }}
5229
5330runs :
8360 echo " Version: $VERSION"
8461 echo " Schemes: $SCHEMES"
8562
86- - name : Checkout Existing Docs
87- if : ${{ inputs.keep-old-versions == 'true' }}
88- shell : bash
89- continue-on-error : true
90- run : |
91- echo "📦 Checking for existing documentation..."
92- git fetch origin gh-pages:gh-pages 2>/dev/null || echo "No gh-pages branch yet"
93-
94- # Try to checkout existing docs
95- if git show-ref --verify --quiet refs/heads/gh-pages; then
96- git checkout gh-pages -- . 2>/dev/null || echo "Could not checkout gh-pages"
97-
98- if [ -d "docs" ]; then
99- mkdir -p docs-old
100- cp -r docs/* docs-old/ 2>/dev/null || true
101- echo "✅ Backed up existing documentation"
102- fi
103-
104- git checkout ${{ github.ref_name }}
105- fi
106-
107- - name : Build DocC Documentation
63+ - name : Build DocC
10864 id : build
10965 shell : bash
11066 run : |
@@ -177,195 +133,3 @@ runs:
177133 echo "docs_path=$DOCS_DIR" >> $GITHUB_OUTPUT
178134 echo ""
179135 echo "🎉 Documentation generated for $REPO_NAME version $VERSION"
180-
181- - name : Create Index Page
182- shell : bash
183- run : |
184- CURRENT_VERSION="${{ steps.version.outputs.VERSION }}"
185- REPO_NAME=$(basename "$GITHUB_REPOSITORY")
186-
187- cat > docs/index.html << 'EOF'
188- <!DOCTYPE html>
189- <html lang="en">
190- <head>
191- <meta charset="UTF-8">
192- <meta name="viewport" content="width=device-width, initial-scale=1.0">
193- <title>Validator Documentation</title>
194- <style>
195- * {
196- margin: 0;
197- padding: 0;
198- box-sizing: border-box;
199- }
200- body {
201- font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
202- background: #f5f5f7;
203- min-height: 100vh;
204- display: flex;
205- align-items: center;
206- justify-content: center;
207- padding: 40px 20px;
208- color: #1d1d1f;
209- }
210- .container {
211- max-width: 980px;
212- width: 100%;
213- }
214- header {
215- text-align: center;
216- margin-bottom: 60px;
217- }
218- h1 {
219- font-size: 56px;
220- font-weight: 600;
221- letter-spacing: -0.005em;
222- line-height: 1.07143;
223- margin-bottom: 8px;
224- color: #1d1d1f;
225- }
226- .subtitle {
227- font-size: 28px;
228- font-weight: 400;
229- line-height: 1.14286;
230- color: #6e6e73;
231- }
232- .version-badge {
233- display: inline-block;
234- background: #0071e3;
235- color: white;
236- padding: 6px 14px;
237- border-radius: 16px;
238- font-size: 14px;
239- font-weight: 600;
240- margin-top: 12px;
241- }
242- .docs-grid {
243- display: grid;
244- grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
245- gap: 24px;
246- margin-bottom: 40px;
247- }
248- .doc-card {
249- background: white;
250- border-radius: 18px;
251- padding: 40px;
252- box-shadow: 0 4px 12px rgba(0,0,0,0.08);
253- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
254- text-decoration: none;
255- display: block;
256- border: 1px solid rgba(0,0,0,0.06);
257- }
258- .doc-card:hover {
259- transform: translateY(-4px);
260- box-shadow: 0 12px 24px rgba(0,0,0,0.12);
261- }
262- .doc-card h2 {
263- font-size: 32px;
264- font-weight: 600;
265- margin-bottom: 12px;
266- color: #1d1d1f;
267- letter-spacing: -0.003em;
268- }
269- .doc-card p {
270- font-size: 17px;
271- line-height: 1.47059;
272- color: #6e6e73;
273- margin-bottom: 20px;
274- }
275- .doc-card .link {
276- font-size: 17px;
277- color: #0071e3;
278- font-weight: 400;
279- display: inline-flex;
280- align-items: center;
281- }
282- .doc-card .link::after {
283- content: '→';
284- margin-left: 8px;
285- transition: transform 0.3s ease;
286- }
287- .doc-card:hover .link::after {
288- transform: translateX(4px);
289- }
290- .module-badge {
291- display: inline-block;
292- background: #f5f5f7;
293- color: #6e6e73;
294- padding: 4px 12px;
295- border-radius: 12px;
296- font-size: 12px;
297- font-weight: 600;
298- letter-spacing: 0.5px;
299- text-transform: uppercase;
300- margin-bottom: 16px;
301- }
302- footer {
303- text-align: center;
304- padding-top: 40px;
305- border-top: 1px solid rgba(0,0,0,0.08);
306- margin-top: 40px;
307- }
308- footer p {
309- font-size: 14px;
310- color: #86868b;
311- }
312- @media (max-width: 768px) {
313- h1 {
314- font-size: 40px;
315- }
316- .subtitle {
317- font-size: 21px;
318- }
319- .docs-grid {
320- grid-template-columns: 1fr;
321- }
322- .doc-card {
323- padding: 32px;
324- }
325- }
326- </style>
327- </head>
328- <body>
329- <div class="container">
330- <header>
331- <h1>Validator</h1>
332- <p class="subtitle">Comprehensive documentation for Swift validation framework</p>
333- <span class="version-badge">VERSION_PLACEHOLDER</span>
334- </header>
335-
336- <div class="docs-grid">
337- <a href="VERSION_PLACEHOLDER/ValidatorCore/documentation/validatorcore" class="doc-card">
338- <span class="module-badge">Core Module</span>
339- <h2>ValidatorCore</h2>
340- <p>Core validation functionality and rules for Swift applications. Contains base types, protocols, and validator implementations.</p>
341- <span class="link">View documentation</span>
342- </a>
343-
344- <a href="VERSION_PLACEHOLDER/ValidatorUI/documentation/validatorui" class="doc-card">
345- <span class="module-badge">UI Module</span>
346- <h2>ValidatorUI</h2>
347- <p>UI components and helpers for building validation interfaces. Ready-to-use solutions for SwiftUI and UIKit.</p>
348- <span class="link">View documentation</span>
349- </a>
350- </div>
351-
352- <footer>
353- <p>Generated with Swift DocC</p>
354- </footer>
355- </div>
356- </body>
357- </html>
358- EOF
359-
360- # Replace VERSION_PLACEHOLDER with actual version
361- sed -i '' "s/VERSION_PLACEHOLDER/$CURRENT_VERSION/g" docs/index.html || \
362- sed -i "s/VERSION_PLACEHOLDER/$CURRENT_VERSION/g" docs/index.html
363-
364- echo "✅ Index page created with version $CURRENT_VERSION"
365-
366- - name : Deploy to GitHub Pages
367- uses : peaceiris/actions-gh-pages@v3
368- with :
369- github_token : ${{ inputs.github-token }}
370- publish_dir : ./docs
371- force_orphan : true
0 commit comments