Skip to content

Commit fbc92c2

Browse files
committed
docs: docs CI init
1 parent 5df5e4f commit fbc92c2

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/docs.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
cache: "pip"
29+
30+
- name: Install Poetry
31+
run: pip install poetry
32+
33+
- name: Install dependencies (with docs)
34+
run: poetry install --with docs
35+
36+
- name: Generate API + copy notebooks
37+
run: poetry run python docs/source/generate_api.py
38+
39+
- name: Build docs (Sphinx)
40+
run: |
41+
poetry run sphinx-build -E -a -b html docs/source docs/build/html
42+
touch docs/build/html/.nojekyll
43+
44+
- name: Upload docs preview artifact
45+
if: github.event_name == 'pull_request'
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: docs-html-preview
49+
path: docs/build/html
50+
retention-days: 7
51+
52+
- name: Upload Pages artifact
53+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
54+
uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: docs/build/html
57+
58+
deploy:
59+
needs: build
60+
runs-on: ubuntu-latest
61+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
62+
permissions:
63+
pages: write
64+
id-token: write
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
steps:
69+
- id: deployment
70+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)