Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a developer docs workflow #322

Merged
merged 10 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Publish Develop Docs

on:
push:
branches:
- main

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setting up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.10"
architecture: x64
- name: Setting up nox
uses: wntrblm/[email protected]
with:
python-versions: "3.10"
- name: Configure Git Credentials
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
- name: Build Documentation
run: |
git fetch origin gh-pages:gh-pages
nox -s docs -- deploy --update-aliases dev
git push origin gh-pages
7 changes: 7 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ theme:
name: Switch to dark mode
plugins:
search: null
mike: null
mkdocstrings:
handlers:
python:
Expand All @@ -42,6 +43,12 @@ plugins:
show_root_heading: true
filters:
- '!^_'
extra:
version:
provider: mike
default:
- latest
- dev
markdown_extensions:
- toc:
toc_depth: 2
Expand Down
8 changes: 8 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ def bump(session: nox.Session) -> None:
session.run("pdm", "bump", *session.posargs, external=True)


@nox.session
def docs(session: nox.Session) -> None:
"""Builds and deploys the code documentation."""
args = session.posargs or []
session.run_always("pdm", "install", "--group", "docs", external=True)
session.run("pdm", "run", "mike", *args)


@nox.session
def build(session: nox.Session) -> None:
"""Builds the source and wheel distributions."""
Expand Down
118 changes: 116 additions & 2 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ test = [
]
docs = [
"mkdocs>=1.5.3",
"mkdocstrings[python]>=0.24.0",
"mkdocs-material>=9.5.6",
"mkdocstrings[python]>=0.24.0",
"mike>=2.0.0",
"setuptools>=62.3.3",
"markdown-exec>=0.7.0",
"mkdocs-redirects>=1.2.0",
"mkdocs-version-annotations>=1.0.0",
]
dev = [
"isort>=5.12.0",
Expand All @@ -100,8 +105,13 @@ dev = [
"pytest>=7.2.2",
"pytest-cov>=4.1.0",
"mkdocs>=1.5.3",
"mkdocstrings[python]>=0.24.0",
"mkdocs-material>=9.5.6",
"mkdocstrings[python]>=0.24.0",
"mike>=2.0.0",
"setuptools>=62.3.3",
"markdown-exec>=0.7.0",
"mkdocs-redirects>=1.2.0",
"mkdocs-version-annotations>=1.0.0",
]

[tool.isort]
Expand Down