Add OpenAPI JSON to Release #1
Workflow file for this run
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: Add OpenAPI JSON to Release | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| attach-openapi-json: | |
| name: Attach OpenAPI JSON to Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.9" # Adjust based on your project version | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Generate OpenAPI JSON | |
| run: | | |
| python -c "from main import app; import json; open('openapi.json', 'w').write(json.dumps(app.openapi()))" | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./openapi.json | |
| asset_name: openapi.json | |
| asset_content_type: application/json |