Skip to content

Commit

Permalink
docs: add redirect file to release archive
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Aug 2, 2024
1 parent 3c017fb commit 23e91a0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/osr_mechanical/console/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def build(self) -> None:
self.release_directory.mkdir()

self.readme(self.release_directory / "README.md")
self.docs_redirect_file(self.release_directory / "docs-redirect.html")
self.changelog(self.release_directory / "CHANGELOG.md")
self.final_assembly_step(self.release_directory / f"{PROJECT_NAME}.step")
self.final_assembly_png(self.release_directory / f"{PROJECT_NAME}.png")
Expand Down Expand Up @@ -79,6 +80,21 @@ def readme(out_file: Path) -> int:

return out_file.write_text(result)

@staticmethod
def docs_redirect_file(out_file: Path) -> int:
"""Create docs redirect file."""
env = Environment(
loader=PackageLoader("osr_mechanical"),
autoescape=select_autoescape(),
)

template = env.get_template("docs-redirect.html")
result = template.render(
project_url=PROJECT_URL,
)

return out_file.write_text(result)

@staticmethod
def changelog(out_file: Path) -> int:
"""Create changelog."""
Expand Down
17 changes: 17 additions & 0 deletions src/osr_mechanical/templates/docs-redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url={{ project_url }}">
<script>
window.location.href = "{{ project_url }}"
</script>
<title>Page redirection</title>
</head>
<body>
<p>
If you are not redirected automatically, follow this
<a href="{{ project_url }}">link to {{ project_url }}</a>.
</p>
</body>
</html>

0 comments on commit 23e91a0

Please sign in to comment.