Skip to content

docs: add a documentation #4

docs: add a documentation

docs: add a documentation #4

Workflow file for this run

# .github/workflows/deploy-docc.yml
name: Deploy DocC Documentation
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
actions: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Get repository name
id: repo-name
run: echo "REPO_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT
- name: Build DocC Documentation
uses: ./.github/actions/build-docc
with:
products: 'ValidatorCore,ValidatorUI'
docc-paths: 'Sources/ValidatorCore/Validator.docc,Sources/ValidatorUI/ValidatorUI.docc'
bundle-identifier-prefix: 'dev.validator'
bundle-version: '1.0.0'
platforms: 'iOS,macOS,watchOS,tvOS,visionOS'
output-path: './docs'
hosting-base-path: '${{ steps.repo-name.outputs.REPO_NAME }}'
- name: Create Index Page
run: |
cat > docs/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Validator Documentation</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: #f5f5f7;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 40px 20px;
color: #1d1d1f;
}
.container {
max-width: 980px;
width: 100%;
}
header {
text-align: center;
margin-bottom: 60px;
}
h1 {
font-size: 56px;
font-weight: 600;
letter-spacing: -0.005em;
line-height: 1.07143;
margin-bottom: 8px;
color: #1d1d1f;
}
.subtitle {
font-size: 28px;
font-weight: 400;
line-height: 1.14286;
color: #6e6e73;
}
.docs-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 24px;
margin-bottom: 40px;
}
.doc-card {
background: white;
border-radius: 18px;
padding: 40px;
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
text-decoration: none;
display: block;
border: 1px solid rgba(0,0,0,0.06);
}
.doc-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}
.doc-card h2 {
font-size: 32px;
font-weight: 600;
margin-bottom: 12px;
color: #1d1d1f;
letter-spacing: -0.003em;
}
.doc-card p {
font-size: 17px;
line-height: 1.47059;
color: #6e6e73;
margin-bottom: 20px;
}
.doc-card .link {
font-size: 17px;
color: #0071e3;
font-weight: 400;
display: inline-flex;
align-items: center;
}
.doc-card .link::after {
content: '→';
margin-left: 8px;
transition: transform 0.3s ease;
}
.doc-card:hover .link::after {
transform: translateX(4px);
}
.module-badge {
display: inline-block;
background: #f5f5f7;
color: #6e6e73;
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.5px;
text-transform: uppercase;
margin-bottom: 16px;
}
footer {
text-align: center;
padding-top: 40px;
border-top: 1px solid rgba(0,0,0,0.08);
margin-top: 40px;
}
footer p {
font-size: 14px;
color: #86868b;
}
@media (max-width: 768px) {
h1 {
font-size: 40px;
}
.subtitle {
font-size: 21px;
}
.docs-grid {
grid-template-columns: 1fr;
}
.doc-card {
padding: 32px;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Validator</h1>
<p class="subtitle">Comprehensive documentation for Swift validation framework</p>
</header>
<div class="docs-grid">
<a href="ValidatorCore/documentation/validatorcore/" class="doc-card">
<span class="module-badge">Core Module</span>
<h2>ValidatorCore</h2>
<p>Core validation functionality and rules for Swift applications. Contains base types, protocols, and validator implementations.</p>
<span class="link">View documentation</span>
</a>
<a href="ValidatorUI/documentation/validatorui/" class="doc-card">
<span class="module-badge">UI Module</span>
<h2>ValidatorUI</h2>
<p>UI components and helpers for building validation interfaces. Ready-to-use solutions for SwiftUI and UIKit.</p>
<span class="link">View documentation</span>
</a>
</div>
<footer>
<p>Generated with Swift DocC</p>
</footer>
</div>
</body>
</html>
EOF
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
publish_branch: gh-pages
force_orphan: true