Fix incorrect relative imports with --use-exact-imports and --collapse-root-models #1186
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: Docs | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| concurrency: | |
| group: docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-deploy: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: 3.13 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Copy CHANGELOG to docs | |
| run: | | |
| if [ -f CHANGELOG.md ]; then | |
| cp CHANGELOG.md docs/changelog.md | |
| else | |
| echo "# Changelog" > docs/changelog.md | |
| echo "" >> docs/changelog.md | |
| echo "Changelog will be available after the first release." >> docs/changelog.md | |
| fi | |
| - name: Update GitHub Action version in docs | |
| run: python scripts/update_docs_version.py | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: build site | |
| run: zensical build --clean | |
| # PR Preview Deploy (skip forked PRs as secrets are not available) | |
| - name: Deploy Preview | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy site --project-name=datamodel-code-generator --branch=pr-${{ github.event.pull_request.number }} | |
| - name: Comment Preview URL on PR | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const previewUrl = 'https://pr-${{ github.event.pull_request.number }}.datamodel-code-generator.pages.dev'; | |
| const body = `📚 **Docs Preview:** ${previewUrl}`; | |
| // Check if comment already exists | |
| const comments = await github.rest.issues.listComments({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const existingComment = comments.data.find(c => c.body.includes('Docs Preview:')); | |
| if (existingComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existingComment.id, | |
| body: body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); | |
| } | |
| # Dev Deploy (on push to main) | |
| - name: Deploy Dev | |
| if: github.event_name == 'push' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy site --project-name=datamodel-code-generator --branch=dev | |
| # Production Deploy (on release only) | |
| - name: Deploy Production | |
| if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy site --project-name=datamodel-code-generator --branch=main |