-
Notifications
You must be signed in to change notification settings - Fork 647
156 lines (137 loc) · 5.86 KB
/
docs.yml
File metadata and controls
156 lines (137 loc) · 5.86 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
156
name: Generate and Publish Docs
on:
workflow_dispatch:
workflow_call:
jobs:
docs:
name: Generate and Publish Documentation
runs-on: ubuntu-latest
environment: docs-publish
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate JSON documentation for all packages
run: pnpm nx run-many --target=docs:json --all
- name: Prepare GitHub Pages structure
run: |
# Create the docs output directory
mkdir -p ./gh-pages
# Copy each package's spec.json to a structure that matches the original URLs
# auth-js
mkdir -p ./gh-pages/auth-js/v2
cp ./packages/core/auth-js/docs/v2/spec.json ./gh-pages/auth-js/v2/spec.json || echo "No spec.json for auth-js"
# functions-js
mkdir -p ./gh-pages/functions-js/v2
cp ./packages/core/functions-js/docs/v2/spec.json ./gh-pages/functions-js/v2/spec.json || echo "No spec.json for functions-js"
# postgrest-js
mkdir -p ./gh-pages/postgrest-js/v2
cp ./packages/core/postgrest-js/docs/v2/spec.json ./gh-pages/postgrest-js/v2/spec.json || echo "No spec.json for postgrest-js"
# realtime-js
mkdir -p ./gh-pages/realtime-js/v2
cp ./packages/core/realtime-js/docs/v2/spec.json ./gh-pages/realtime-js/v2/spec.json || echo "No spec.json for realtime-js"
# storage-js
mkdir -p ./gh-pages/storage-js/v2
cp ./packages/core/storage-js/docs/v2/spec.json ./gh-pages/storage-js/v2/spec.json || echo "No spec.json for storage-js"
# supabase-js
mkdir -p ./gh-pages/supabase-js/v2
cp ./packages/core/supabase-js/docs/v2/spec.json ./gh-pages/supabase-js/v2/spec.json || echo "No spec.json for supabase-js"
# Create an index.html for the root
cat > ./gh-pages/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>Supabase JS Libraries Documentation</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
line-height: 1.6;
}
h1 {
color: #333;
border-bottom: 2px solid #3ecf8e;
padding-bottom: 10px;
}
ul {
list-style: none;
padding: 0;
}
li {
margin: 10px 0;
}
a {
color: #3ecf8e;
text-decoration: none;
font-size: 18px;
}
a:hover {
text-decoration: underline;
}
.description {
color: #666;
font-size: 14px;
margin-top: 5px;
}
</style>
</head>
<body>
<h1>Supabase JavaScript Libraries - API Documentation</h1>
<p>TypeScript/JavaScript API documentation for all Supabase JS SDKs.</p>
<h2>Available Documentation:</h2>
<ul>
<li>
<a href="auth-js/v2/spec.json">@supabase/auth-js</a>
<div class="description">Authentication SDK</div>
</li>
<li>
<a href="functions-js/v2/spec.json">@supabase/functions-js</a>
<div class="description">Edge Functions SDK</div>
</li>
<li>
<a href="postgrest-js/v2/spec.json">@supabase/postgrest-js</a>
<div class="description">PostgREST database SDK</div>
</li>
<li>
<a href="realtime-js/v2/spec.json">@supabase/realtime-js</a>
<div class="description">Realtime subscriptions SDK</div>
</li>
<li>
<a href="storage-js/v2/spec.json">@supabase/storage-js</a>
<div class="description">File storage SDK</div>
</li>
<li>
<a href="supabase-js/v2/spec.json">@supabase/supabase-js</a>
<div class="description">Main isomorphic SDK combining all SDKs</div>
</li>
</ul>
<hr style="margin-top: 50px; border: 1px solid #eee;">
<p style="color: #999; font-size: 12px;">
Generated from the <a href="https://github.com/supabase/supabase-js">supabase-js</a> monorepo.
</p>
</body>
</html>
EOF
echo "GitHub Pages structure created:"
find ./gh-pages -name "*.json" -o -name "*.html" | head -20
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
force_orphan: true
commit_message: 'docs: update API documentation'