1+ name : Deploy DocC Documentation
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ workflow_dispatch :
7+
8+ permissions :
9+ contents : write
10+ pages : write
11+ id-token : write
12+ actions : read
13+
14+ concurrency :
15+ group : pages-${{ github.head_ref }}
16+ cancel-in-progress : false
17+
18+ jobs :
19+ build-and-deploy :
20+ runs-on : macos-14
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@v4
24+
25+ - name : Setup Xcode
26+ uses : maxim-lobanov/setup-xcode@v1
27+ with :
28+ xcode-version : latest-stable
29+
30+ - name : Setup Build Directories
31+ run : |
32+ mkdir -p .build/symbol-graphs
33+ mkdir -p docs
34+
35+ - name : Build ValidatorCore Symbol Graphs
36+ run : |
37+ PRODUCT="ValidatorCore"
38+ PLATFORMS=("iOS" "watchOS" "tvOS" "visionOS" "macOS")
39+
40+ for PLATFORM in "${PLATFORMS[@]}"; do
41+ echo "Building ${PRODUCT} for ${PLATFORM}"
42+ SYMBOL_DIR=".build/symbol-graphs/${PRODUCT}/${PLATFORM}"
43+ mkdir -p "${SYMBOL_DIR}"
44+
45+ xcodebuild build \
46+ -scheme "${PRODUCT}" \
47+ -destination "generic/platform=${PLATFORM}" \
48+ -derivedDataPath .deriveddata \
49+ DOCC_EXTRACT_EXTENSION_SYMBOLS=YES \
50+ OTHER_SWIFT_FLAGS="-Xfrontend -emit-symbol-graph -Xfrontend -emit-symbol-graph-dir -Xfrontend ${SYMBOL_DIR} -Xfrontend -emit-extension-block-symbols" \
51+ 2>&1 | grep -v "note:" | grep -v "warning:" || true
52+ done
53+
54+ - name : Build ValidatorUI Symbol Graphs
55+ run : |
56+ PRODUCT="ValidatorUI"
57+ PLATFORMS=("iOS" "watchOS" "tvOS" "visionOS" "macOS")
58+
59+ for PLATFORM in "${PLATFORMS[@]}"; do
60+ echo "Building ${PRODUCT} for ${PLATFORM}"
61+ SYMBOL_DIR=".build/symbol-graphs/${PRODUCT}/${PLATFORM}"
62+ mkdir -p "${SYMBOL_DIR}"
63+
64+ xcodebuild build \
65+ -scheme "${PRODUCT}" \
66+ -destination "generic/platform=${PLATFORM}" \
67+ -derivedDataPath .deriveddata \
68+ DOCC_EXTRACT_EXTENSION_SYMBOLS=YES \
69+ OTHER_SWIFT_FLAGS="-Xfrontend -emit-symbol-graph -Xfrontend -emit-symbol-graph-dir -Xfrontend ${SYMBOL_DIR} -Xfrontend -emit-extension-block-symbols" \
70+ 2>&1 | grep -v "note:" | grep -v "warning:" || true
71+ done
72+
73+ - name : Generate ValidatorCore Documentation
74+ run : |
75+ PRODUCT="ValidatorCore"
76+ DOCC_PATH="Sources/ValidatorCore/Validator.docc"
77+
78+ if [ -d "${DOCC_PATH}" ]; then
79+ $(xcrun --find docc) convert "${DOCC_PATH}" \
80+ --fallback-display-name "${PRODUCT}" \
81+ --fallback-bundle-identifier "dev.validator.${PRODUCT}" \
82+ --fallback-bundle-version 1.0.0 \
83+ --output-dir "${PRODUCT}.doccarchive" \
84+ --additional-symbol-graph-dir ".build/symbol-graphs/${PRODUCT}"
85+ else
86+ echo "Warning: ${DOCC_PATH} not found, generating from code comments only"
87+ $(xcrun --find docc) convert \
88+ --fallback-display-name "${PRODUCT}" \
89+ --fallback-bundle-identifier "dev.validator.${PRODUCT}" \
90+ --fallback-bundle-version 1.0.0 \
91+ --output-dir "${PRODUCT}.doccarchive" \
92+ --additional-symbol-graph-dir ".build/symbol-graphs/${PRODUCT}"
93+ fi
94+
95+ $(xcrun --find docc) process-archive transform-for-static-hosting \
96+ "${PRODUCT}.doccarchive" \
97+ --output-path "docs/${PRODUCT}" \
98+ --hosting-base-path ""
99+
100+ - name : Generate ValidatorUI Documentation
101+ run : |
102+ PRODUCT="ValidatorUI"
103+ DOCC_PATH="Sources/ValidatorUI/ValidatorUI.docc"
104+
105+ if [ -d "${DOCC_PATH}" ]; then
106+ $(xcrun --find docc) convert "${DOCC_PATH}" \
107+ --fallback-display-name "${PRODUCT}" \
108+ --fallback-bundle-identifier "dev.validator.${PRODUCT}" \
109+ --fallback-bundle-version 1.0.0 \
110+ --output-dir "${PRODUCT}.doccarchive" \
111+ --additional-symbol-graph-dir ".build/symbol-graphs/${PRODUCT}"
112+ else
113+ echo "Warning: ${DOCC_PATH} not found, generating from code comments only"
114+ $(xcrun --find docc) convert \
115+ --fallback-display-name "${PRODUCT}" \
116+ --fallback-bundle-identifier "dev.validator.${PRODUCT}" \
117+ --fallback-bundle-version 1.0.0 \
118+ --output-dir "${PRODUCT}.doccarchive" \
119+ --additional-symbol-graph-dir ".build/symbol-graphs/${PRODUCT}"
120+ fi
121+
122+ $(xcrun --find docc) process-archive transform-for-static-hosting \
123+ "${PRODUCT}.doccarchive" \
124+ --output-path "docs/${PRODUCT}" \
125+ --hosting-base-path ""
126+
127+ - name : Create Index Page
128+ run : |
129+ cat > docs/index.html << 'EOF'
130+ <!DOCTYPE html>
131+ <html lang="en">
132+ <head>
133+ <meta charset="UTF-8">
134+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
135+ <title>Validator Documentation</title>
136+ <style>
137+ * {
138+ margin: 0;
139+ padding: 0;
140+ box-sizing: border-box;
141+ }
142+ body {
143+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
144+ background: #f5f5f7;
145+ min-height: 100vh;
146+ display: flex;
147+ align-items: center;
148+ justify-content: center;
149+ padding: 40px 20px;
150+ color: #1d1d1f;
151+ }
152+ .container {
153+ max-width: 980px;
154+ width: 100%;
155+ }
156+ header {
157+ text-align: center;
158+ margin-bottom: 60px;
159+ }
160+ h1 {
161+ font-size: 56px;
162+ font-weight: 600;
163+ letter-spacing: -0.005em;
164+ line-height: 1.07143;
165+ margin-bottom: 8px;
166+ color: #1d1d1f;
167+ }
168+ .subtitle {
169+ font-size: 28px;
170+ font-weight: 400;
171+ line-height: 1.14286;
172+ color: #6e6e73;
173+ }
174+ .docs-grid {
175+ display: grid;
176+ grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
177+ gap: 24px;
178+ margin-bottom: 40px;
179+ }
180+ .doc-card {
181+ background: white;
182+ border-radius: 18px;
183+ padding: 40px;
184+ box-shadow: 0 4px 12px rgba(0,0,0,0.08);
185+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
186+ text-decoration: none;
187+ display: block;
188+ border: 1px solid rgba(0,0,0,0.06);
189+ }
190+ .doc-card:hover {
191+ transform: translateY(-4px);
192+ box-shadow: 0 12px 24px rgba(0,0,0,0.12);
193+ }
194+ .doc-card h2 {
195+ font-size: 32px;
196+ font-weight: 600;
197+ margin-bottom: 12px;
198+ color: #1d1d1f;
199+ letter-spacing: -0.003em;
200+ }
201+ .doc-card p {
202+ font-size: 17px;
203+ line-height: 1.47059;
204+ color: #6e6e73;
205+ margin-bottom: 20px;
206+ }
207+ .doc-card .link {
208+ font-size: 17px;
209+ color: #0071e3;
210+ font-weight: 400;
211+ display: inline-flex;
212+ align-items: center;
213+ }
214+ .doc-card .link::after {
215+ content: '→';
216+ margin-left: 8px;
217+ transition: transform 0.3s ease;
218+ }
219+ .doc-card:hover .link::after {
220+ transform: translateX(4px);
221+ }
222+ .module-badge {
223+ display: inline-block;
224+ background: #f5f5f7;
225+ color: #6e6e73;
226+ padding: 4px 12px;
227+ border-radius: 12px;
228+ font-size: 12px;
229+ font-weight: 600;
230+ letter-spacing: 0.5px;
231+ text-transform: uppercase;
232+ margin-bottom: 16px;
233+ }
234+ footer {
235+ text-align: center;
236+ padding-top: 40px;
237+ border-top: 1px solid rgba(0,0,0,0.08);
238+ margin-top: 40px;
239+ }
240+ footer p {
241+ font-size: 14px;
242+ color: #86868b;
243+ }
244+ @media (max-width: 768px) {
245+ h1 {
246+ font-size: 40px;
247+ }
248+ .subtitle {
249+ font-size: 21px;
250+ }
251+ .docs-grid {
252+ grid-template-columns: 1fr;
253+ }
254+ .doc-card {
255+ padding: 32px;
256+ }
257+ }
258+ </style>
259+ </head>
260+ <body>
261+ <div class="container">
262+ <header>
263+ <h1>Validator</h1>
264+ <p class="subtitle">Comprehensive documentation for Swift validation framework</p>
265+ </header>
266+
267+ <div class="docs-grid">
268+ <a href="ValidatorCore/documentation/validatorcore/" class="doc-card">
269+ <span class="module-badge">Core Module</span>
270+ <h2>ValidatorCore</h2>
271+ <p>Core validation functionality and rules for Swift applications. Contains base types, protocols, and validator implementations.</p>
272+ <span class="link">View documentation</span>
273+ </a>
274+
275+ <a href="ValidatorUI/documentation/validatorui/" class="doc-card">
276+ <span class="module-badge">UI Module</span>
277+ <h2>ValidatorUI</h2>
278+ <p>UI components and helpers for building validation interfaces. Ready-to-use solutions for SwiftUI and UIKit.</p>
279+ <span class="link">View documentation</span>
280+ </a>
281+ </div>
282+
283+ <footer>
284+ <p>Generated with Swift DocC</p>
285+ </footer>
286+ </div>
287+ </body>
288+ </html>
289+ EOF
290+
291+ - name : Deploy to gh-pages
292+ uses : peaceiris/actions-gh-pages@v3
293+ with :
294+ github_token : ${{ secrets.GITHUB_TOKEN }}
295+ publish_dir : ./docs
296+ publish_branch : gh-pages
297+ force_orphan : true
298+
299+ - name : Cleanup
300+ if : always()
301+ run : |
302+ rm -rf .deriveddata
303+ rm -rf .build
304+ rm -rf *.doccarchive
0 commit comments