This file contains hidden or 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 Swagger files to Azure Static Web App | |
env: | |
APP_LOCATION: "/" | |
OUTPUT_LOCATION: "swagger" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
permissions: | |
issues: write | |
contents: read | |
pull-requests: write | |
jobs: | |
build_and_deploy: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) | |
runs-on: ubuntu-latest | |
name: Build and Deploy Swagger Documentation | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.13.1 | |
- name: Update Pip and Install Required Python Libraries | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install virtualenv | |
virtualenv venv | |
source ./venv/bin/activate | |
pip install -r ./requirements.txt | |
pip install -r ./requirements-dev.txt | |
python3 ./manage.py spectacular --color --format openapi-json --file ./swagger/schema.json | |
- name: Deploy Swagger File | |
uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} | |
action: "upload" | |
skip_app_build: true | |
app_location: ${{ env.APP_LOCATION }} | |
output_location: ${{ env.OUTPUT_LOCATION }} |