fix bugs and update tests #13
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: Generate and Deploy API Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| # Позволяет запускать этот workflow вручную из вкладки Actions | |
| workflow_dispatch: | |
| # Разрешения для развертывания на GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Настраиваем environment для GitHub Pages | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install json-schema-for-humans | |
| - name: Generate API documentation | |
| run: | | |
| # Очищаем директорию docs, сохраняя .gitkeep если он есть | |
| mkdir -p docs | |
| find docs -type f -not -name ".gitkeep" -delete | |
| # Генерируем документацию по схемам используя generate-schema-doc с конфигом | |
| generate-schema-doc --config-file json_schema_for_humans_config.json tests/__snapshots__/ docs | |
| # Создаем индексную страницу | |
| python create_index_schema.py | |
| # Добавляем файл .nojekyll для корректной работы GitHub Pages | |
| touch docs/.nojekyll | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './docs' | |
| # Отдельная задача для деплоя на GitHub Pages | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |