Skip to content

Commit 6732b72

Browse files
committed
Add ReDoc GitHub Pages deployment for OpenAPI spec
1 parent 8211cda commit 6732b72

File tree

3 files changed

+56
-28
lines changed

3 files changed

+56
-28
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
1-
name: Deploy API Docs
1+
name: Deploy OpenAPI docs to GitHub Pages
2+
23
on:
34
push:
4-
branches: [main, add-genome-groups]
5-
paths: ['APISpecification.yaml'] # Only run when spec changes
5+
branches:
6+
- main
7+
- add-genome-groups
8+
paths:
9+
- 'docs/**'
10+
- '.github/workflows/deploy-docs.yml'
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: 'pages'
19+
cancel-in-progress: true
620

721
jobs:
822
deploy:
23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deployment.outputs.page_url }}
926
runs-on: ubuntu-latest
27+
1028
steps:
11-
- uses: actions/checkout@v4
12-
13-
- name: Create documentation page
14-
run: |
15-
cat > index.html << 'EOF'
16-
<!DOCTYPE html>
17-
<html>
18-
<head>
19-
<title>API Documentation</title>
20-
<meta charset="utf-8"/>
21-
<meta name="viewport" content="width=device-width, initial-scale=1">
22-
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
23-
<style> body { margin: 0; padding: 0; } </style>
24-
</head>
25-
<body>
26-
<redoc spec-url='APISpecification.yaml'></redoc>
27-
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
28-
</body>
29-
</html>
30-
EOF
29+
- name: Checkout
30+
uses: actions/checkout@v4
3131

32-
- name: Deploy to GitHub Pages
33-
uses: peaceiris/actions-gh-pages@v3
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v5
34+
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v3
3437
with:
35-
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
publish_dir: ./
37-
publish_branch: gh-pages
38+
path: docs
39+
40+
- name: Deploy to GitHub Pages
41+
id: deployment
42+
uses: actions/deploy-pages@v4

docs/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>API Documentation</title>
6+
<!-- ReDoc standalone bundle via CDN -->
7+
<script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"></script>
8+
<style>
9+
body {
10+
margin: 0;
11+
padding: 0;
12+
}
13+
redoc {
14+
width: 100vw;
15+
height: 100vh;
16+
}
17+
</style>
18+
</head>
19+
<body>
20+
<!-- ReDoc mounts here -->
21+
<redoc spec-url="APISpecification.yaml"></redoc>
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)