forked from pydantic/pydantic
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (87 loc) · 3.14 KB
/
docs-update.yml
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
name: Publish Documentation
on:
push:
branches:
- main
- docs-update
tags:
- '**'
env:
COLUMNS: 150
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
python-version: '3.11'
cache: true
- name: install
run: pdm install -G linting -G email
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --verbose
env:
SKIP: no-commit-to-branch
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
python-version: '3.11'
cache: true
- name: install deps
run: pdm install -G testing -G email
- run: pdm info && pdm list
- run: 'pdm 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@v4
with:
ref: docs-site
- name: checkout current branch
uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
python-version: '3.10'
- name: install
run: |
pdm venv create --with-pip --force $PYTHON
pdm install -G docs
pdm run python -m pip install --extra-index-url https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ mkdocs-material
env:
PPPR_TOKEN: ${{ secrets.PPPR_TOKEN }}
- run: pdm run python -c 'import docs.plugins.main'
# Adding local symlinks gets nice source locations like
# pydantic_core/core_schema.py
# instead of
# .venv/lib/python3.10/site-packages/pydantic_core/core_schema.py
- 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: pdm 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/[email protected]
with:
version_file_path: 'pydantic/version.py'
skip_env_check: true
- run: pdm 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 }}