File: docs-update.yml

package info (click to toggle)
pydantic 2.12.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,640 kB
  • sloc: python: 75,984; javascript: 181; makefile: 115; sh: 38
file content (112 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Publish Documentation

on:
  push:
    branches:
      - main
      - docs-update
    tags:
      - '**'
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  COLUMNS: 150
  UV_FROZEN: true

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - uses: astral-sh/setup-uv@v7
        with:
          python-version: '3.13'

      - name: Install dependencies
        # Installing pip is required for the pre-commit action:
        run: |
          uv sync --group linting --all-extras
          uv pip install pip

      - uses: pre-commit/action@v3.0.1
        with:
          extra_args: --all-files --verbose
        env:
          SKIP: no-commit-to-branch

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - uses: astral-sh/setup-uv@v7
        with:
          python-version: '3.13'

      - name: Install dependencies
        run: uv sync --group testing-extra --all-extras

      - run: 'uv run python -c "import pydantic.version; print(pydantic.version.version_info())"'

      - run: make test

  publish:
    # Compare with the docs-build job in .github/workflows/ci.yml
    needs: [lint, test]
    runs-on: ubuntu-latest
    timeout-minutes: 30

    steps:
      - name: Checkout docs-site
        uses: actions/checkout@v5
        with:
          ref: docs-site

      - name: Checkout current branch
        uses: actions/checkout@v5

      - uses: astral-sh/setup-uv@v7
        with:
          python-version: '3.13'

      - run: uv sync --group docs --group docs-upload

      - run: uv pip install --default-index https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ mkdocs-material
        env:
          PPPR_TOKEN: ${{ secrets.PPPR_TOKEN }}

      - run: uv run python -c 'import docs.plugins.main'

      # Taken from docs-build.sh
      - name: Prepare shortcuts for extra modules
        run: |
          ln -s .venv/lib/python*/site-packages/pydantic_core pydantic_core
          ln -s .venv/lib/python*/site-packages/pydantic_settings pydantic_settings
          ln -s .venv/lib/python*/site-packages/pydantic_extra_types pydantic_extra_types

      - name: Set git credentials
        run: |
          git config --global user.name "${{ github.actor }}"
          git config --global user.email "${{ github.actor }}@users.noreply.github.com"

      - run: PYTHONPATH="$PWD${PYTHONPATH:+:${PYTHONPATH}}" uv run mike deploy -b docs-site dev --push
        if: github.ref == 'refs/heads/main'

      - if: github.ref == 'refs/heads/docs-update' || startsWith(github.ref, 'refs/tags/')
        id: check-version
        uses: samuelcolvin/check-python-version@v5
        with:
          version_file_path: 'pydantic/version.py'
          skip_env_check: true

      - run: PYTHONPATH="$PWD${PYTHONPATH:+:${PYTHONPATH}}" uv run mike deploy -b docs-site ${{ steps.check-version.outputs.VERSION_MAJOR_MINOR }} latest --update-aliases --push
        if: ${{ (github.ref == 'refs/heads/docs-update' || startsWith(github.ref, 'refs/tags/')) && !fromJSON(steps.check-version.outputs.IS_PRERELEASE) }}
        env:
          PYDANTIC_VERSION: v${{ steps.check-version.outputs.VERSION }}

      - run: uv run python docs/plugins/algolia.py upload
        env:
          ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}