@@ -120,6 +120,70 @@ Find more examples in [the tests](./.github/workflows/test-mkdocs-workflow.yml).
120120 output-directory: custom_site_dir
121121` ` `
122122
123+ # ## Locked Requirements for Reproducible Builds
124+
125+ To guarantee your documentation builds consistently over time and avoid plugin version incompatibilities,
126+ lock your dependencies using `pip-tools`.
127+
128+ Assuming you have a local Python installation :
129+
130+ Create a `docs/requirements.in` with MkDocs Material and your plugins :
131+
132+ ` ` ` txt
133+ mkdocs-material==9.5.24
134+ mkdocs-git-revision-date-localized-plugin
135+ mkdocs-awesome-pages-plugin
136+ mkdocs-minify-plugin
137+ ` ` `
138+
139+ Generate locked `docs/requirements.txt` :
140+
141+ ` ` ` bash
142+ pip install pip-tools
143+ pip-compile docs/requirements.in -o docs/requirements.txt
144+ ` ` `
145+
146+ Use in workflow :
147+
148+ ` ` ` yaml
149+ - name: Deploy MkDocs
150+ uses: Reloaded-Project/devops-mkdocs@v1
151+ with:
152+ requirements: ./docs/requirements.txt
153+ ` ` `
154+
155+ **Note:** If `mkdocs-material` is present in your `requirements.txt`, the action will install only
156+ from the requirements file (ignoring the `mkdocs-version` input). If `mkdocs-material` is not in
157+ your requirements, the action will install it from the `mkdocs-version` input alongside your
158+ requirements, letting pip resolve compatible versions.
159+
160+ To update dependencies, edit `docs/requirements.in` and regenerate :
161+
162+ ` ` ` bash
163+ pip-compile --upgrade docs/requirements.in -o docs/requirements.txt
164+ ` ` `
165+
166+ # ### Testing Locally
167+
168+ Test locked requirements in a clean environment :
169+
170+ ` ` ` bash
171+ # Create and activate virtual environment
172+ python -m venv .venv
173+ source .venv/bin/activate # Windows: .venv\S cripts\a ctivate
174+
175+ # Install pip-tools and generate locked requirements
176+ pip install pip-tools
177+ pip-compile docs/requirements.in -o docs/requirements.txt
178+
179+ # Install and test
180+ pip install -r docs/requirements.txt
181+ mkdocs build
182+
183+ # Deactivate when done
184+ deactivate
185+ ` ` `
186+
123187# # Viewing the Generated Docs
124188
125189After a successful run, the generated static site will be available on the GitHub Pages site for
0 commit comments