Skip to content

test(action): fastapi docs try out #1

test(action): fastapi docs try out

test(action): fastapi docs try out #1

Workflow file for this run

name: Deploy FastAPI Docs to GitHub Pages
on:
push:
branches:
- main
- feat/fast-api
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install uvicorn
- name: Run FastAPI app in background
run: |
nohup uvicorn api:app --host 0.0.0.0 --port 8000 &
sleep 5 # Give the server time to start
- name: Fetch OpenAPI schema
run: |
curl http://localhost:8000/openapi.json -o openapi.json
- name: Install redoc-cli
run: |
npm install -g redoc-cli
- name: Generate HTML from OpenAPI spec
run: |
redoc-cli bundle openapi.json -o docs/index.html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs