merge from latest codes https://github.com/aws-samples/aws-genai-llm-… #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Published API Documantation | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
pip install -r backend/requirements.txt | |
- name: Set Environment Variables | |
run: | | |
echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV | |
echo "PUBLISHED_API_ID=api_id" >> $GITHUB_ENV | |
- name: Start FastAPI server | |
run: | | |
cd backend | |
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 & | |
sleep 10 | |
env: | |
AWS_REGION: ${{ env.AWS_REGION }} | |
- name: Download OpenAPI JSON | |
run: | | |
wget http://127.0.0.1:8000/openapi.json -O openapi.json | |
- name: Install redoc-cli | |
run: | | |
npm install -g redoc-cli | |
- name: Generate REDOC static HTML | |
run: | | |
mkdir -p redoc | |
npx redoc-cli bundle openapi.json -o docs/index.html | |
- name: Kill FastAPI server | |
run: | | |
pkill uvicorn | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs |