Skip to content

Commit c8e5025

Browse files
committed
add build and check docs tasks
1 parent 87408b1 commit c8e5025

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

docs/dev/dev_environment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ To either stop or destroy the development environment use the following options.
4545

4646
## Poetry
4747

48-
Poetry is used in lieu of the "virtualenv" commands and is leveraged in both environments. The virtual environment will provide all of the Python packages required to manage the development environment such as **Invoke**. See the [Local Development Environment](#local-poetry-development-environment) section to see how to install Jdiff if you're going to be developing locally (i.e. not using the Docker container).
48+
Poetry is used in lieu of the "virtualenv" commands and is leveraged in both environments. The virtual environment will provide all of the Python packages required to manage the development environment such as **Invoke**. See the [Local Development Environment](#docker-development-environment) section to see how to install Jdiff if you're going to be developing locally (i.e. not using the Docker container).
4949

5050
The `pyproject.toml` file outlines all of the relevant dependencies for the project:
5151

tasks.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""Tasks for use with Invoke."""
22

3+
import re
4+
from pathlib import Path
5+
36
from invoke import Collection, Exit
47
from invoke import task as invoke_task
58

@@ -230,6 +233,23 @@ def tests(context):
230233
print("All tests have passed!")
231234

232235

236+
@task
237+
def build_and_check_docs(context):
238+
"""Build documentation to be available within Nautobot."""
239+
command = "mkdocs build --no-directory-urls --strict"
240+
run_command(context, command)
241+
242+
# Check for the existence of a release notes file for the current version if it's not a prerelease.
243+
version = context.run("poetry version --short", hide=True)
244+
match = re.match(r"^(\d+)\.(\d+)\.\d+$", version.stdout.strip())
245+
if match:
246+
major = match.group(1)
247+
minor = match.group(2)
248+
release_notes_file = Path(__file__).parent / "docs" / "admin" / "release_notes" / f"version_{major}.{minor}.md"
249+
if not release_notes_file.exists():
250+
print(f"Release notes file `version_{major}.{minor}.md` does not exist.")
251+
raise Exit(code=1)
252+
233253
@task
234254
def docs(context):
235255
"""Build and serve docs locally for development."""

0 commit comments

Comments
 (0)