-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>rtfm docs</title> | ||
</head> | ||
<body> | ||
<h3>Documentation Versions</h3> | ||
<ul> | ||
{% for version in versions %} | ||
<li> | ||
<a href="/{{ version }}">{{ version }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Jinja2==3.1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from pathlib import Path | ||
import os | ||
import re | ||
import jinja2 | ||
|
||
VERSION_RE = re.compile( | ||
r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)\.(?P<micro>[0-9]+)(?:(?P<level>[ab])(?P<serial>[0-9]*))?" | ||
) | ||
|
||
|
||
def main(): | ||
scripts_dir = Path(os.path.dirname(__file__)) | ||
root_dir = Path(*scripts_dir.parts[:-2]) | ||
|
||
index_fp = root_dir / "index.html" | ||
|
||
versions = [ | ||
folder.name | ||
for folder in root_dir.glob("*") | ||
if folder.is_dir and VERSION_RE.fullmatch(folder.name) | ||
] | ||
|
||
env = jinja2.Environment(loader=jinja2.PackageLoader("update_index", "")) | ||
template = env.get_template("index_template.html") | ||
|
||
with index_fp.open("w", encoding="UTF-8") as f: | ||
f.write(template.render(versions=versions)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Update Root Index | ||
|
||
on: | ||
push: | ||
branches: | ||
- gh-pages | ||
|
||
jobs: | ||
update_index: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
python_ver: 3.13 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.python_ver }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.python_ver }} | ||
|
||
- name: Goto scripts dir | ||
run: | | ||
cd .github | ||
cd scripts | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
|
||
- name: Update Index | ||
run: | | ||
python update_index.py |