-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdocumentation_check_build_deploy.yml
More file actions
96 lines (83 loc) · 3.17 KB
/
documentation_check_build_deploy.yml
File metadata and controls
96 lines (83 loc) · 3.17 KB
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
name: Documentation-Check-Build-Deploy
on:
workflow_dispatch: # Manually trigger a workflow run using the GitHub API, GitHub CLI, or the GitHub UI.
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
permissions:
contents: read # required to checkout repoistory
jobs:
doc-generated-check:
name: Check that the Python API documentation reflects the code base.
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.02
- name: Set up Python 3.11
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
id: setup-uv
with:
# Install a specific version of uv.
version: "0.11.8"
enable-cache: true
restore-cache: true
save-cache: true
prune-cache: true
cache-dependency-glob: "**/scripts/py2md.py.lock"
python-version: 3.11
- name: check uv cache is working
if: steps.setup-uv.outputs.cache-hit == 'true'
run: echo "uv cache was restored"
- name: Check if the Python API documentation is up to date if not raise an error
run: |
make create-api-docs
if [ $(git status -s | wc -l) -gt 0 ]; then echo "Need to run 'make create-api-docs' to generate the new Python API documentation and commit the documentation to the repository."; exit 1; fi
doc-build-check-upload:
name: Check documentation can build and if the main branch upload build
runs-on: ubuntu-latest
needs: doc-generated-check
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.02
- name: Enables corepack so that Yarn v4 is used
run: corepack enable
- name: Node JS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'yarn'
cache-dependency-path: './docs/yarn.lock'
- name: Test Build
working-directory: ./docs
run: |
yarn install --frozen-lockfile
yarn build
- name: Upload build
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ./docs/build
deploy:
name: Deploy to GitHub Pages
needs: doc-build-check-upload
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy pages to GitHub
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0