Skip to content

Commit 9f37ff2

Browse files
committed
docs: improve docs generation
1 parent 2d9228c commit 9f37ff2

3 files changed

Lines changed: 269 additions & 185 deletions

File tree

.github/actions/generate-index/action.yml

Lines changed: 14 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -5,196 +5,28 @@ author: 'Nikita Vasilev'
55
inputs:
66
version:
77
required: true
8+
description: 'Documentation version'
89
project-name:
910
required: true
11+
description: 'Project display name'
1012
project-description:
1113
required: true
14+
description: 'Project description'
15+
modules:
16+
required: false
17+
description: 'JSON array of modules (e.g., [{"name":"ValidatorCore","path":"validatorcore","description":"Core validation functionality"}])'
18+
default: '[]'
1219

1320
runs:
1421
using: 'composite'
1522
steps:
1623
- name: Generate index.html
1724
shell: bash
25+
env:
26+
VERSION: ${{ inputs.version }}
27+
PROJECT_NAME: ${{ inputs.project-name }}
28+
PROJECT_DESC: ${{ inputs.project-description }}
29+
MODULES: ${{ inputs.modules }}
1830
run: |
19-
CURRENT_VERSION="${{ inputs.version }}"
20-
REPO_NAME=$(basename "$GITHUB_REPOSITORY")
21-
22-
cat > docs/index.html << 'EOF'
23-
<!DOCTYPE html>
24-
<html lang="en">
25-
<head>
26-
<meta charset="UTF-8">
27-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
28-
<title>$REPO_NAME Documentation</title>
29-
<style>
30-
* {
31-
margin: 0;
32-
padding: 0;
33-
box-sizing: border-box;
34-
}
35-
body {
36-
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
37-
background: #f5f5f7;
38-
min-height: 100vh;
39-
display: flex;
40-
align-items: center;
41-
justify-content: center;
42-
padding: 40px 20px;
43-
color: #1d1d1f;
44-
}
45-
.container {
46-
max-width: 980px;
47-
width: 100%;
48-
}
49-
header {
50-
text-align: center;
51-
margin-bottom: 60px;
52-
}
53-
h1 {
54-
font-size: 56px;
55-
font-weight: 600;
56-
letter-spacing: -0.005em;
57-
line-height: 1.07143;
58-
margin-bottom: 8px;
59-
color: #1d1d1f;
60-
}
61-
.subtitle {
62-
font-size: 28px;
63-
font-weight: 400;
64-
line-height: 1.14286;
65-
color: #6e6e73;
66-
}
67-
.version-badge {
68-
display: inline-block;
69-
background: #0071e3;
70-
color: white;
71-
padding: 6px 14px;
72-
border-radius: 16px;
73-
font-size: 14px;
74-
font-weight: 600;
75-
margin-top: 12px;
76-
}
77-
.docs-grid {
78-
display: grid;
79-
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
80-
gap: 24px;
81-
margin-bottom: 40px;
82-
}
83-
.doc-card {
84-
background: white;
85-
border-radius: 18px;
86-
padding: 40px;
87-
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
88-
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
89-
text-decoration: none;
90-
display: block;
91-
border: 1px solid rgba(0,0,0,0.06);
92-
}
93-
.doc-card:hover {
94-
transform: translateY(-4px);
95-
box-shadow: 0 12px 24px rgba(0,0,0,0.12);
96-
}
97-
.doc-card h2 {
98-
font-size: 32px;
99-
font-weight: 600;
100-
margin-bottom: 12px;
101-
color: #1d1d1f;
102-
letter-spacing: -0.003em;
103-
}
104-
.doc-card p {
105-
font-size: 17px;
106-
line-height: 1.47059;
107-
color: #6e6e73;
108-
margin-bottom: 20px;
109-
}
110-
.doc-card .link {
111-
font-size: 17px;
112-
color: #0071e3;
113-
font-weight: 400;
114-
display: inline-flex;
115-
align-items: center;
116-
}
117-
.doc-card .link::after {
118-
content: '→';
119-
margin-left: 8px;
120-
transition: transform 0.3s ease;
121-
}
122-
.doc-card:hover .link::after {
123-
transform: translateX(4px);
124-
}
125-
.module-badge {
126-
display: inline-block;
127-
background: #f5f5f7;
128-
color: #6e6e73;
129-
padding: 4px 12px;
130-
border-radius: 12px;
131-
font-size: 12px;
132-
font-weight: 600;
133-
letter-spacing: 0.5px;
134-
text-transform: uppercase;
135-
margin-bottom: 16px;
136-
}
137-
footer {
138-
text-align: center;
139-
padding-top: 40px;
140-
border-top: 1px solid rgba(0,0,0,0.08);
141-
margin-top: 40px;
142-
}
143-
footer p {
144-
font-size: 14px;
145-
color: #86868b;
146-
}
147-
@media (max-width: 768px) {
148-
h1 {
149-
font-size: 40px;
150-
}
151-
.subtitle {
152-
font-size: 21px;
153-
}
154-
.docs-grid {
155-
grid-template-columns: 1fr;
156-
}
157-
.doc-card {
158-
padding: 32px;
159-
}
160-
}
161-
</style>
162-
</head>
163-
<body>
164-
<div class="container">
165-
<header>
166-
<h1>${{ inputs.project_name }}</h1>
167-
<p class="subtitle">${{ inputs.project_descritpion }}</p>
168-
<span class="version-badge">VERSION_PLACEHOLDER</span>
169-
</header>
170-
171-
<div class="docs-grid">
172-
<a href="VERSION_PLACEHOLDER/ValidatorCore/documentation/validatorcore" class="doc-card">
173-
<span class="module-badge">Core Module</span>
174-
<h2>ValidatorCore</h2>
175-
<p>Core validation functionality and rules for Swift applications. Contains base types, protocols, and validator implementations.</p>
176-
<span class="link">View documentation</span>
177-
</a>
178-
179-
<a href="VERSION_PLACEHOLDER/ValidatorUI/documentation/validatorui" class="doc-card">
180-
<span class="module-badge">UI Module</span>
181-
<h2>ValidatorUI</h2>
182-
<p>UI components and helpers for building validation interfaces. Ready-to-use solutions for SwiftUI and UIKit.</p>
183-
<span class="link">View documentation</span>
184-
</a>
185-
</div>
186-
187-
<footer>
188-
<p>Generated with Swift DocC</p>
189-
</footer>
190-
</div>
191-
</body>
192-
</html>
193-
EOF
194-
195-
# Replace VERSION_PLACEHOLDER with actual version
196-
sed -i '' "s/VERSION_PLACEHOLDER/$CURRENT_VERSION/g" docs/index.html || \
197-
sed -i "s/VERSION_PLACEHOLDER/$CURRENT_VERSION/g" docs/index.html
198-
199-
echo "✅ Index page created with version $CURRENT_VERSION"
200-
31+
chmod +x "${{ github.action_path }}/generate-index.sh"
32+
"${{ github.action_path }}/generate-index.sh"

0 commit comments

Comments
 (0)