-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (136 loc) · 4.58 KB
/
docs.yml
File metadata and controls
155 lines (136 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Documentation
on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'backend/**/*.py'
- 'frontend/**/*.tsx'
- 'frontend/**/*.ts'
- 'README.md'
- '.github/workflows/docs.yml'
pull_request:
paths:
- 'docs/**'
- 'backend/**/*.py'
- 'frontend/**/*.tsx'
- 'frontend/**/*.ts'
- 'README.md'
- '.github/workflows/docs.yml'
jobs:
generate-api-docs:
name: Generate API Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Create placeholder API docs
run: |
# Create placeholder directory structure
mkdir -p backend/docs/build
# Create simple API docs index
cat > backend/docs/build/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>OpenWatch API Documentation</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; margin: 40px; line-height: 1.6; }
h1 { color: #3f51b5; }
.note { background: #f5f5f5; padding: 15px; border-left: 4px solid #3f51b5; }
</style>
</head>
<body>
<h1>OpenWatch API Documentation</h1>
<div class="note">
<p><strong>Note:</strong> Full API documentation generation is currently being configured.</p>
<p>For now, please refer to:</p>
<ul>
<li><a href="/api/openapi.json">OpenAPI Specification (JSON)</a></li>
<li><a href="https://github.com/Hanalyx/OpenWatch">Source Code on GitHub</a></li>
<li><a href="http://localhost:8000/docs">Local API Docs (FastAPI Swagger UI)</a></li>
</ul>
</div>
</body>
</html>
EOF
# Create empty openapi.json as placeholder
echo '{"info": {"title": "OpenWatch API", "version": "1.0"}, "paths": {}}' > backend/openapi.json
- name: Upload documentation artifacts
uses: actions/upload-artifact@v6
with:
name: api-documentation
path: |
backend/docs/build/
backend/openapi.json
build-user-docs:
name: Build User Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Create simple documentation index
run: |
# Create site directory with simple index
mkdir -p site
cat > site/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>OpenWatch Documentation</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
h1 { color: #3f51b5; }
a { color: #3f51b5; text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<h1>OpenWatch Documentation</h1>
<p>Security compliance scanning platform</p>
<ul>
<li><a href="../">Back to Repository</a></li>
<li><a href="api/">API Documentation</a></li>
<li><a href="https://github.com/Hanalyx/OpenWatch">GitHub Repository</a></li>
</ul>
</body>
</html>
EOF
- name: Upload user documentation
uses: actions/upload-artifact@v6
with:
name: user-documentation
path: site/
deploy-docs:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: [generate-api-docs, build-user-docs]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download documentation artifacts
uses: actions/download-artifact@v5
- name: Prepare GitHub Pages
run: |
# Debug: List artifacts structure
echo "=== Artifacts structure ==="
ls -la
mkdir -p public
# Copy user documentation (site/)
if [ -d "user-documentation" ]; then
cp -r user-documentation/* public/
fi
# Copy API documentation
mkdir -p public/api
if [ -d "api-documentation" ]; then
cp -r api-documentation/* public/api/
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: docs.openwatch.hanalyx.com