Skip to content

Commit 81762b8

Browse files
authored
Add documentation workflow to deploy mkdocs (#39)
1 parent 06588bb commit 81762b8

File tree

5 files changed

+137
-1
lines changed

5 files changed

+137
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
# Default to bash
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
build:
26+
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
- name: Install dependencies
34+
run: |
35+
pipx install hatch
36+
hatch env create
37+
- name: Build
38+
run: hatch run docs-build
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: ./site
43+
44+
deploy:
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
runs-on: ubuntu-latest
49+
needs: build
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--8<-- "README.md"

docs/reference.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reference
2+
3+
::: pythonkuma
4+
options:
5+
show_root_heading: false
6+
show_source: false

mkdocs.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
site_name: pythonkuma
2+
site_description: Simple Python wrapper for Uptime Kuma
3+
4+
repo_url: https://github.com/tr4nt0r/pythonkuma
5+
repo_name: tr4nt0r/pythonkuma
6+
7+
theme:
8+
name: material
9+
icon:
10+
logo: material/library
11+
palette:
12+
# Palette toggle for automatic mode
13+
- media: "(prefers-color-scheme)"
14+
toggle:
15+
icon: material/brightness-auto
16+
name: Switch to light mode
17+
18+
# Palette toggle for light mode
19+
- media: "(prefers-color-scheme: light)"
20+
scheme: default
21+
primary: pink
22+
accent: purple
23+
toggle:
24+
icon: material/brightness-7
25+
name: Switch to dark mode
26+
27+
# Palette toggle for dark mode
28+
- media: "(prefers-color-scheme: dark)"
29+
scheme: slate
30+
primary: pink
31+
accent: purple
32+
toggle:
33+
icon: material/brightness-4
34+
name: Switch to light mode
35+
36+
markdown_extensions:
37+
- toc:
38+
permalink: true
39+
- pymdownx.highlight:
40+
anchor_linenums: true
41+
- pymdownx.tasklist:
42+
custom_checkbox: true
43+
- pymdownx.inlinehilite
44+
- pymdownx.snippets
45+
- pymdownx.superfences
46+
47+
plugins:
48+
- search
49+
- mkdocstrings:
50+
handlers:
51+
python:
52+
paths: [src]
53+
import:
54+
- https://docs.python.org/3.12/objects.inv
55+
options:
56+
docstring_style: numpy
57+
merge_init_into_class: false
58+
show_signature: false
59+
members_order: source
60+
61+
62+
watch:
63+
- docs
64+
- pythonkuma
65+
66+
nav:
67+
- About: index.md
68+
- Reference:
69+
- pythonkuma: reference.md

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ dev = [
2929
"aiohttp==3.12.12",
3030
"prometheus-client==0.22.1",
3131
"mashumaro==3.16",
32+
"mkdocs-material==9.6.9",
33+
"mkdocstrings[python]==0.29.0",
3234
]
3335

3436
[project.urls]
3537
Source = "https://github.com/tr4nt0r/pythonkuma"
38+
Documentation = "https://tr4nt0r.github.io/pythonkuma"
3639

3740
[tool.hatch.version]
3841
source = "regex_commit"
@@ -66,4 +69,8 @@ pythonpath = ["pythonkuma"]
6669
extra-dependencies = [
6770
"pythonkuma[dev]",
6871
"pytest-cov==6.1.1",
69-
]
72+
]
73+
74+
[tool.hatch.envs.default.scripts]
75+
docs-serve = "mkdocs serve"
76+
docs-build = "mkdocs build"

0 commit comments

Comments
 (0)