Repository navigation
109 lines (95 loc) · 3.17 KB
/
Copy pathdocs.yml
File metadata and controls
109 lines (95 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
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI Docs
on:
push:
branches:
- main
pull_request:
jobs:
build-docs:
name: "Build Docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history for accurate page timestamps
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[docs]"
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install d2 (for rendering D2 diagrams into the docs)
run: |
curl -fsSL https://d2lang.com/install.sh | sh -s -- --version v0.8.2
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
"$HOME/.local/bin/d2" --version
- name: Build docs
run: great-docs build
- name: Save docs artifact
uses: actions/upload-artifact@v7
with:
name: docs-html
path: docs/_site
include-hidden-files: true
- name: How to preview this build locally
if: github.event_name == 'pull_request'
run: great-docs ci notice --run ${{ github.run_id }} --pr ${{ github.event.number }}
- name: Upload build timings
uses: actions/upload-artifact@v7
with:
name: build-timings
path: docs/_site/build-timings.json
publish-docs:
name: "Publish Docs"
runs-on: ubuntu-latest
needs: "build-docs"
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/download-artifact@v7
with:
name: docs-html
path: docs/_site
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/_site
include-hidden-files: true
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
preview-docs:
name: "Preview Docs"
runs-on: ubuntu-latest
needs: "build-docs"
if: github.event_name == 'pull_request'
permissions:
pull-requests: write
steps:
# Install the PR's own great-docs and let it post the sticky preview
# comment. Running the in-repo build (rather than a released version)
# means this job exercises the code under review. Kept as its own minimal
# job so the docs build — which runs PR-authored code — never holds a
# pull-requests:write token. continue-on-error so fork PRs (read-only
# token) don't fail the run; the build job's log notice still covers them.
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install great-docs
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Post preview instructions to the PR
continue-on-error: true
run: great-docs ci pr-comment --run ${{ github.run_id }} --pr ${{ github.event.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}