Skip to content

Commit 70fccbd

Browse files
authored
Merge pull request #30 from kraken-tech/docs
Add mkdocs with material theme, built to github pages using Mike
2 parents 8da34a0 + 3ebae68 commit 70fccbd

6 files changed

Lines changed: 103 additions & 1 deletion

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build main branch docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
steps:
12+
- uses: actions/checkout@v5
13+
with:
14+
fetch-depth: 0
15+
- uses: actions/setup-python@v6
16+
with:
17+
python-version: 3.13
18+
- name: Install Dependencies
19+
run: |
20+
pip install --group docs
21+
- name: Configure git
22+
run: |
23+
git config --global user.name "GitHub docs action"
24+
git config --global user.email "django-subatomic+docs@example.com"
25+
- name: Build Docs Site
26+
run: |
27+
mike deploy --push --update-aliases dev

.github/workflows/update-docs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build release docs
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/checkout@v5
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-python@v6
15+
with:
16+
python-version: 3.13
17+
- name: Install Dependencies
18+
run: |
19+
pip install --group docs
20+
- name: Configure git
21+
run: |
22+
git config --global user.name "GitHub docs action"
23+
git config --global user.email "django-subatomic+docs@example.com"
24+
- name: Build Docs Site
25+
run: |
26+
mike deploy --push --update-aliases ${{ github.event.release.tag_name }} latest
27+
mike set-default latest --push

CONTRIBUTING.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,34 @@ Python dependencies are declared in `pyproject.toml`.
8989
- _package_ dependencies in the `dependencies` array in the `[project]` section.
9090
- _development_ dependencies in the `[dependency-groups]` section.
9191

92-
[semver]: https://semver.org/
92+
## Docs
93+
94+
Our documentation lives in the `docs/` directory.
95+
It is written in Markdown, and built with [MkDocs].
96+
We use the [Material for MkDocs] theme.
97+
Every time we merge or make a release,
98+
a GitHub Action runs [Mike],
99+
which commits a new version of the docs to the `gh-pages` branch
100+
so that it is deployed to [GitHub Pages].
101+
102+
To build the docs locally, you will need the "docs" dependency-group installed
103+
(if you have already installed the "dev" group, you can skip this):
104+
105+
```
106+
pip install --group docs
107+
```
108+
109+
Once you have the dependencies installed,
110+
you can serve the docs locally with:
111+
112+
```
113+
mkdocs serve
114+
```
115+
116+
117+
[GitHub Pages]: https://pages.github.com/
118+
[Material for MkDocs]: https://squidfunk.github.io/mkdocs-material/
119+
[Mike]: https://github.com/jimporter/mike
120+
[MkDocs]: https://www.mkdocs.org/
93121
[keepachangelog]: https://keepachangelog.com/
122+
[semver]: https://semver.org/

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Subatomic docs

mkdocs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
site_name: Django-subatomic docs
2+
repo_name: kraken-tech/django-subatomic
3+
repo_url: https://github.com/kraken-tech/django-subatomic
4+
theme:
5+
name: material
6+
extra:
7+
version:
8+
provider: mike
9+
alias: true
10+
default:
11+
- latest
12+
plugins:
13+
- mike

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ default-groups = []
6262

6363
[dependency-groups]
6464
dev = [
65+
{include-group = "docs"},
6566
{include-group = "mypy"},
6667
{include-group = "test_runners"},
6768
{include-group = "python_tests"},
6869
"pre-commit",
6970
]
71+
docs = [
72+
"mike",
73+
"mkdocs-material",
74+
]
7075
mypy = [
7176
{include-group = "python_tests"},
7277
"django-stubs[compatible-mypy]",

0 commit comments

Comments
 (0)