Skip to content

Commit 9ed8c3d

Browse files
Merge pull request #1 from Diego-Espindola/issue#54
feat(docs): configurar GitHub Actions para publicação no GitHub Pages
2 parents 98fc2ce + 72209f6 commit 9ed8c3d

File tree

3 files changed

+1164
-0
lines changed

3 files changed

+1164
-0
lines changed

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy API Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.12'
19+
20+
- name: Install Python dependencies (mínimas para OpenAPI)
21+
run: |
22+
pip install fastapi sqlmodel sqlalchemy aiosqlite
23+
24+
- name: Export OpenAPI schema
25+
env:
26+
SECRET_KEY: dummy
27+
ALGORITHM: HS256
28+
ACCESS_TOKEN_EXPIRE_MINUTES: 20
29+
SQLITE_PATH: /tmp/pynewsdb.db
30+
SQLITE_URL: sqlite+aiosqlite:////tmp/pynewsdb.db
31+
PYTHONPATH: .
32+
run: |
33+
python scripts/export_openapi.py app.main:app openapi.json
34+
35+
- name: Set up Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: '20'
39+
40+
- name: Generate static docs (Redoc)
41+
run: |
42+
npx --yes redoc-cli bundle openapi.json -o docs/index.html
43+
44+
- name: Deploy to GitHub Pages
45+
uses: peaceiris/actions-gh-pages@v4
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
publish_dir: ./docs

0 commit comments

Comments
 (0)