Skip to content

Commit

Permalink
Stop the release script from rebuilding the docs every time
Browse files Browse the repository at this point in the history
  • Loading branch information
martinburchell committed Jan 9, 2025
1 parent b23d0d9 commit 254595f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tools/release_new_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
DOCS_SOURCE_DIR = os.path.join(DOCS_DIR, "source")

CHANGELOG = os.path.join(DOCS_SOURCE_DIR, "changelog.rst")
NLP_HELP_FILE = os.path.join(DOCS_SOURCE_DIR, "nlp", "_crate_nlp_help.txt")
VERSION_FILE = os.path.join(PROJECT_ROOT, "crate_anon", "version.py")
DOCKER_ENV_FILE = os.path.join(PROJECT_ROOT, "docker", "dockerfiles", ".env")

Expand Down Expand Up @@ -93,6 +94,10 @@ class VersionReleaser:
)
docker_version_replace = r"\g<1>{major}\g<3>{minor}\g<5>{patch}\g<7>"

nlp_help_version_search = (
r"(^NLP manager. Version )(\d+)(\.)(\d+)(\.)(\d+)"
)

def __init__(
self,
new_version: Version,
Expand Down Expand Up @@ -418,7 +423,19 @@ def perform_checks(self) -> None:
def check_docs(self) -> None:
# The GitHub docs workflow will do a more thorough check. This
# will hopefully be enough.
self.rebuild_docs()
if self.get_nlp_help_file_version() != self.new_version:
self.rebuild_docs()

def get_nlp_help_file_version(self) -> Version:
with open(NLP_HELP_FILE, "r") as f:
for line in f.readlines():
m = re.match(self.nlp_help_version_search, line)
if m is not None:
return Version(
major=int(m.group(2)),
minor=int(m.group(4)),
patch=int(m.group(6)),
)

def rebuild_docs(self) -> None:
self.run_with_check([REBUILD_DOCS, "--warnings_as_errors"])
Expand Down

0 comments on commit 254595f

Please sign in to comment.