-
Notifications
You must be signed in to change notification settings - Fork 92
95 lines (83 loc) · 3.82 KB
/
docs_build.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
name: Docs Build
on:
workflow_dispatch:
inputs:
version: { type: string, required: false, description: "The version to build (used in git and pypi). git-tag='v{version}-docs'. If not specified then use selected branch and wheel from the last successful build."}
latest: { type: boolean, required: false, description: Alias this version as the 'latest' stable docs. This should be set for the latest stable release.}
deploy: { type: boolean, required: false, description: Push the built docs to the docs-pages branch on github.}
jobs:
docs_build:
runs-on: ubuntu-latest
environment: TestPypi
permissions:
contents: write
steps:
- name: Check inputs
run: |
if [ -z "${{ inputs.version }}" ] && ${{ inputs.latest }}; then
echo "Cannot label dev build as latest. Failing the job."
exit 1
fi
- name: Checkout
uses: actions/checkout@v3.3.0
with:
ref: ${{inputs.version && format('v{0}-docs', inputs.version) || github.ref}}
- name: Fetch docs-pages branch
run: git fetch origin docs-pages --depth=1
- name: Detect runner Python implementation
if: ${{!inputs.version}}
run: |
python3 -c 'import platform
prefix = {"CPython": "cp", "PyPy": "pp"}[platform.python_implementation()]
v = platform.python_version_tuple()
print(f"PY_IMPL={prefix}{v[0]}{v[1]}")' | tee -a $GITHUB_ENV
- id: download-wheel-artifact
name: Download wheel artifact from last successful build
if: ${{!inputs.version}}
uses: dawidd6/action-download-artifact@v2.28.0
with:
name: wheel-${{env.PY_IMPL}}-manylinux_x86_64
workflow: build.yml
workflow_conclusion: success
branch: ${{github.ref}}
- name: Install documentation dependencies (including ArcticDB)
run: |
set -x
pip3 install mkdocs-material mkdocs-jupyter mkdocstrings[python] black pybind11-stubgen mike ${{inputs.version && format('arcticdb=={0}',inputs.version) || 'arcticdb-*.whl'}}
- name: Stubfile generation for arcticdb_ext
run: |
set -x
cd docs/mkdocs
# stubfiles will be generated into docs/mkdocs/arcticdb_ext and so imported as arcticdb_ext by mkdocs when it builds
# FIXME --ignore-all-errors may mask new errors and should be removed when we are compliant
pybind11-stubgen arcticdb_ext.version_store --ignore-all-errors -o .
- name: List docs versions before deploy
run: |
set -x
cd docs/mkdocs
mike list
- name: Versioned mkDocs build
run: |
set -x
cd docs/mkdocs
# mike needs a git user to be set
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git_hash=$(git rev-parse --short HEAD)
mike deploy ${{inputs.version || 'dev'}} ${{inputs.latest && 'latest' || ''}} --update-aliases --branch docs-pages ${{inputs.deploy && '--push' || ''}} --message "Deploying docs: ${{inputs.version || 'dev'}} $git_hash ${{inputs.latest && '[latest]' || ''}}"
mike set-default latest --branch docs-pages ${{inputs.deploy && '--push' || ''}}
- name: List docs versions after build
run: |
set -x
cd docs/mkdocs
mike list
- name: Checkout docs-pages branch
run: git checkout docs-pages
- name: Deploy Docs to TestPypi
uses: cloudflare/pages-action@v1.5.0
with:
apiToken: ${{secrets.CLOUDFLARE_API_TOKEN}}
accountId: ${{vars.CLOUDFLARE_ACCOUNT_ID}}
projectName: ${{vars.CLOUDFLARE_PAGES_PROJECT}}
directory: .
branch: test