OpenAPI Build¶
Build OpenAPI YAML for use in Swagger or ReDoc documentation sites.
Inputs¶
INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
---|---|---|---|---|
container_user | string | false | "root" |
The user to run the container as. Defaults to root. |
example_env_file_path | string | true | FastAPI must start with an environment set. Path to a .env with dummy vars. |
|
image | string | true | The image to build to OpenAPI JSON (dependencies included, i.e. FastAPI.). |
|
output_file_write_path | string | false | "docs/openapi.json" |
The path to write the OpenAPI JSON file to. Defaults to docs/openapi.json . |
output_path | string | false | If specified, the output dir is uploaded to the artifact key. |
|
py_backend_app_context | string | false | "app.main" |
The context to import the FastAPI app from. Defaults to app.main . |
py_backend_app_name | string | false | "api" |
The name of the FastAPI app. Defaults to api . |
Outputs¶
No outputs.
Secrets¶
No secrets.
Example Usage¶
name: 📖 Publish Docs
on:
push:
paths:
- docs/**
- src/**
- mkdocs.yml
branches: [development]
# Allow manual trigger (workflow_dispatch)
workflow_dispatch:
jobs:
build_openapi_json:
uses: hotosm/gh-workflows/.github/workflows/openapi_build.yml@1.6.0
with:
image: ghcr.io/${{ github.repository }}/backend:ci-${{ github.ref_name }}
example_env_file_path: ".env.example"
output_path: docs/openapi.json
publish_docs:
uses: hotosm/gh-workflows/.github/workflows/mkdocs_build.yml@1.6.0
needs:
- build_openapi_json
with:
image: ghcr.io/${{ github.repository }}/backend:ci-${{ github.ref_name }}
openapi: true