Skip to content

Commit

Permalink
Create a developer docs workflow (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioangatop authored Mar 19, 2024
1 parent 3a09992 commit b565b80
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 4 deletions.
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

0 comments on commit b565b80

Please sign in to comment.