Skip to content

Commit 5c1d7ea

Browse files
authored
enable github pages for website (#3)
* enable github pages for website * dont execute notebooks in docs * add local install to docs actions
1 parent 7d57a0a commit 5c1d7ea

File tree

5 files changed

+135
-4
lines changed

5 files changed

+135
-4
lines changed

.github/workflows/docs_preview.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docs Preview
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- edited
10+
- closed
11+
branches:
12+
- "main"
13+
workflow_dispatch:
14+
15+
concurrency: preview-${{github.ref}}
16+
17+
jobs:
18+
preview:
19+
runs-on: ubuntu-latest
20+
# only run if from the same repository, not a fork
21+
if: github.event.pull_request.head.repo.full_name == github.repository
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
defaults:
26+
run:
27+
shell: bash -l {0}
28+
29+
steps:
30+
# Checkout current git repository
31+
- name: Checkout
32+
uses: actions/checkout@v5
33+
34+
# setup python env
35+
- uses: actions/setup-python@v5
36+
if: github.event.action != 'closed' # Skip the build if the PR has been closed; just run the clean up steps
37+
with:
38+
python-version: "3.x"
39+
40+
- uses: prefix-dev/setup-pixi@v0.9.2
41+
with:
42+
pixi-version: v0.55.0
43+
environments: >-
44+
docs
45+
46+
- id: install_local
47+
run: pip install --no-deps -e .
48+
49+
- id: install_pandoc
50+
run: sudo apt-get install pandoc
51+
52+
# Make API docs
53+
- name: Make API docs
54+
if: github.event.action != 'closed'
55+
run: pixi run api
56+
57+
# Build the documentation
58+
- name: Build the documentation
59+
if: github.event.action != 'closed'
60+
run: pixi run docs
61+
62+
# Deploy the preview of the docs
63+
- name: Deploy Preview
64+
uses: rossjrw/pr-preview-action@v1
65+
with:
66+
source-dir: docs/_build/html
67+
preview-branch: gh-pages
68+
# custom-url:
69+
umbrella-dir: pr-preview
70+
action: auto
71+
deploy-repository: ${{ github.repository }}
72+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
# This job installs dependencies, builds the html, and pushes it to gh-pages
10+
jobs:
11+
docs:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }} # only run one of these jobs at a time
17+
defaults:
18+
run:
19+
shell: bash -l {0}
20+
21+
steps:
22+
# Checkout current git repository
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
26+
# setup python env
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
31+
- uses: prefix-dev/setup-pixi@v0.9.2
32+
with:
33+
pixi-version: v0.55.0
34+
environments: >-
35+
docs
36+
37+
- id: install_local
38+
run: pip install --no-deps -e .
39+
40+
- id: install_pandoc
41+
run: sudo apt-get install pandoc
42+
43+
# Make API docs
44+
- name: Make API docs
45+
run: pixi run api
46+
47+
# Build the documentation
48+
- name: Build the documentation
49+
run: pixi run docs
50+
51+
# Deploy the HTML to gh-pages branch
52+
- name: GitHub Pages action
53+
uses: peaceiris/actions-gh-pages@v4
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
publish_dir: docs/_build/html
57+
publish_branch: gh-pages
58+
force_orphan: true

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# add_function_parentheses = False
6262

6363

64-
nbsphinx_execute = "auto"
64+
nbsphinx_execute = "never"
6565

6666
nbsphinx_execute_arguments = [
6767
"--InlineBackend.figure_formats={'png2x'}",

pixi.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ nbsphinx = "*"
7676
sphinx-autobuild = ">=2024.10.3,<2025"
7777

7878
[tool.pixi.feature.docs.tasks]
79-
docs = "sphinx-autobuild --open-browser -n -T -b html docs docs/_build/html"
79+
docs_interactive = "sphinx-autobuild --open-browser -n -T -b html docs docs/_build/html"
80+
docs = "sphinx-build -n -T -b html docs docs/_build/html"
8081
api = "sphinx-apidoc -o docs/api/ --module-first --no-toc --force src/synthetic_bathymetry_inversion"
8182

8283

0 commit comments

Comments
 (0)