Skip to content

Commit 3573cc0

Browse files
authored
docs: integrate Git contributor avatars in user guide (#242)
1 parent f1eedf1 commit 3573cc0

8 files changed

Lines changed: 71 additions & 18 deletions

File tree

.github/workflows/docs-deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
egress-policy: block
3232
allowed-endpoints: >
3333
github.com:443
34+
api.github.com:443
3435
pypi.org:443
3536
files.pythonhosted.org:443
3637
@@ -53,6 +54,8 @@ jobs:
5354

5455
- name: Build Site
5556
working-directory: docs/user-guide/
57+
env:
58+
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }} # Avoid exceeding the GitHub API rate limits
5659
run: mkdocs build --strict
5760

5861
- name: Upload artifact

.github/workflows/docs-validate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
egress-policy: block
3232
allowed-endpoints: >
3333
github.com:443
34+
api.github.com:443
3435
pypi.org:443
3536
files.pythonhosted.org:443
3637
@@ -53,4 +54,6 @@ jobs:
5354

5455
- name: Build Site
5556
working-directory: docs/user-guide/
57+
env:
58+
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }} # Avoid exceeding the GitHub API rate limits
5659
run: mkdocs build --strict

docs/user-guide/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
FROM docker.io/squidfunk/mkdocs-material:9.6.14@sha256:eb04b60c566a8862be6b553157c16a92fbbfc45d71b7e4e8593526aecca63f52
55

6-
# Add revisioning feature: https://squidfunk.github.io/mkdocs-material/setup/adding-a-git-repository/#revisioning
76
RUN apk add --no-cache git && \
8-
pip install mkdocs-git-revision-date-localized-plugin
7+
pip install \
8+
mkdocs-git-revision-date-localized-plugin \
9+
mkdocs-git-committers-plugin-2

docs/user-guide/README.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,61 @@
1-
# User Guide
1+
# 🧭 User Guide
22

3-
The user guide is made with [MkDocs Material](https://squidfunk.github.io/mkdocs-material/).
3+
This user guide is built using [MkDocs Material](https://squidfunk.github.io/mkdocs-material/), a modern static site generator designed for project
4+
documentation.
45

5-
## Prerequisites
6+
## ⚙️ Prerequisites
67

7-
The only prerequisite is to have [Docker](https://www.docker.com/) installed on your system.
8+
Before getting started, make sure the following tools are installed and properly configured:
89

9-
## Localdev
10+
* 🐳 [Docker](https://www.docker.com/)<br/>
11+
Used to run the local development environment and build the documentation without installing Python or MkDocs directly on your machine.
12+
* 🧑‍💻 [GitHub CLI](https://cli.github.com/)<br/>
13+
Required to authenticate with your GitHub account and generate a personal access token when needed. This is necessary because the `git-committers` MkDocs
14+
plugin may hit the GitHub API's unauthenticated rate limit or require access to private repositories.<br/>
15+
To authenticate, run:
16+
```bash
17+
gh auth login
18+
```
19+
Once authenticated, the GitHub CLI will provide the required token via `gh auth token`, which is used by the local development script when starting the
20+
container.
1021

11-
Run this command:
22+
## 🚀 Local Development
23+
24+
To start the local development server, run:
1225

1326
```bash
1427
./localdev.sh
1528
```
1629

17-
### ⚠️ Caveat
30+
### ⚠️ Important Note
31+
32+
The logs might suggest accessing the preview at `http://0.0.0.0:8000/docker-papermc-server/`, but this will not work.
1833

19-
Don't try to access the preview at `http://0.0.0.0:8000/docker-papermc-server/` as opposed to what may indicate logs.
20-
Doing so will result in a failure.
34+
Instead, open the site using one of the following URLs:
2135

22-
Instead, use `http://localhost:8000/docker-papermc-server/` or `http://127.0.1:8000/docker-papermc-server/`.
36+
* `http://localhost:8000/docker-papermc-server/`
37+
* `http://127.0.0.1:8000/docker-papermc-server/`
2338

24-
## Wrapper Script
39+
## 🛠 Wrapper Script
2540

26-
To run `mkdocs` commands, use the `mkdocs.sh` script. For example:
41+
To run `mkdocs` commands manually, use the `mkdocs.sh` wrapper script. For example:
2742

2843
```bash
2944
./mkdocs.sh build
3045
```
3146

32-
But it is recommended to use the `localdev.sh` script instead unless you know what you are doing.
47+
That said, unless you have a specific reason, it’s recommended to use `localdev.sh`, as it handles everything needed for local development.
48+
49+
## ➕ Adding Dependencies
50+
51+
When introducing new dependencies, make sure to update both the **local development environment** and the **CI build environment**, as they are managed
52+
separately.
53+
54+
### 💻 Locally
55+
56+
To update the local environment, open the `Dockerfile` and modify the `RUN pip install ...` line to include any additional packages you need.
57+
58+
### 🤖 In CI
59+
60+
Dependencies for the CI environment are declared in `requirements.in`. After editing this file to include the new packages, run the `requirements.sh` script.
61+
This will regenerate `requirements.txt`, which is the file actually used by the CI to install dependencies in a consistent and reproducible way.

docs/user-guide/mkdocs.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ docker build -t squidfunk/mkdocs-material "${SCRIPT_DIR}"
2020

2121
echo 'The preview is going to be available at http://localhost:8000/docker-papermc-server/'
2222

23-
docker run --rm -it -p 8000:8000 --volume="${ROOT_PROJECT_DIR}:/docs" --workdir /docs/docs/user-guide --name mkdocs squidfunk/mkdocs-material "$@"
23+
docker run --rm -it -p 8000:8000 --name mkdocs \
24+
--volume="${ROOT_PROJECT_DIR}:/docs" \
25+
--workdir /docs/docs/user-guide \
26+
-e MKDOCS_GIT_COMMITTERS_APIKEY="$(gh auth token)" \
27+
squidfunk/mkdocs-material "$@"

docs/user-guide/mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ plugins:
6969
- search
7070
- git-revision-date-localized:
7171
enable_creation_date: true
72+
- git-committers:
73+
repository: Djaytan/docker-papermc-server
74+
branch: main
7275

7376
markdown_extensions:
7477
- admonition

docs/user-guide/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mkdocs-material
22
mkdocs-git-revision-date-localized-plugin
3+
mkdocs-git-committers-plugin-2

docs/user-guide/requirements.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ gitdb==4.0.12 \
4949
gitpython==3.1.44 \
5050
--hash=sha256:9e0e10cda9bed1ee64bc9a6de50e7e38a9c9943241cd7f585f6df3ed28011110 \
5151
--hash=sha256:c87e30b26253bf5418b01b0660f818967f3c503193838337fe5e573331249269
52-
# via mkdocs-git-revision-date-localized-plugin
52+
# via
53+
# mkdocs-git-committers-plugin-2
54+
# mkdocs-git-revision-date-localized-plugin
5355
idna==3.10 \
5456
--hash=sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9 \
5557
--hash=sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3
@@ -83,12 +85,17 @@ mkdocs==1.6.1 \
8385
--hash=sha256:7b432f01d928c084353ab39c57282f29f92136665bdd6abf7c1ec8d822ef86f2 \
8486
--hash=sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e
8587
# via
88+
# mkdocs-git-committers-plugin-2
8689
# mkdocs-git-revision-date-localized-plugin
8790
# mkdocs-material
8891
mkdocs-get-deps==0.2.0 \
8992
--hash=sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c \
9093
--hash=sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134
9194
# via mkdocs
95+
mkdocs-git-committers-plugin-2==2.5.0 \
96+
--hash=sha256:1778becf98ccdc5fac809ac7b62cf01d3c67d6e8432723dffbb823307d1193c4 \
97+
--hash=sha256:a01f17369e79ca28651681cddf212770e646e6191954bad884ca3067316aae60
98+
# via -r requirements.in
9299
mkdocs-git-revision-date-localized-plugin==1.4.7 \
93100
--hash=sha256:056c0a90242409148f1dc94d5c9d2c25b5b8ddd8de45489fa38f7fa7ccad2bc4 \
94101
--hash=sha256:10a49eff1e1c3cb766e054b9d8360c904ce4fe8c33ac3f6cc083ac6459c91953
@@ -148,7 +155,9 @@ pyyaml-env-tag==1.1 \
148155
requests==2.32.3 \
149156
--hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \
150157
--hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6
151-
# via mkdocs-material
158+
# via
159+
# mkdocs-git-committers-plugin-2
160+
# mkdocs-material
152161
six==1.17.0 \
153162
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
154163
--hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81

0 commit comments

Comments
 (0)