Skip to content

Commit c4c6904

Browse files
committed
chore: update sphinx build for 1.x
1 parent 737acdd commit c4c6904

9 files changed

Lines changed: 573 additions & 197 deletions

File tree

.github/workflows/docs.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish Docs
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- 2.x
8+
- 1.x
9+
10+
concurrency:
11+
group: "pages"
12+
cancel-in-progress: false
13+
14+
jobs:
15+
docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install UV
22+
uses: astral-sh/setup-uv@v7
23+
24+
- name: Set up Python
25+
run: uv python install
26+
27+
- name: Install the project
28+
run: uv sync --locked --all-groups --directory ./docs
29+
30+
- name: Build Docs
31+
run: |
32+
git fetch --all
33+
uv run --directory ./docs sphinx-multiversion . build
34+
35+
- name: Setup Pages
36+
uses: actions/configure-pages@v5
37+
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v3
40+
with:
41+
path: './docs/build'
42+
deploy:
43+
needs: docs
44+
45+
permissions:
46+
contents: read
47+
pages: write
48+
id-token: write
49+
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v4
60+
with:
61+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
name: Tests
22
on:
3-
push:
3+
pull_request:
44
branches:
55
- main
66
- 2.x
7-
pull_request:
7+
- 1.x
88
workflow_dispatch:
99

10-
concurrency:
11-
group: "pages"
12-
cancel-in-progress: false
13-
1410
jobs:
1511
build:
1612
strategy:
@@ -44,46 +40,3 @@ jobs:
4440
token: ${{ secrets.CODECOV_TOKEN }}
4541
slug: jimtools/jwt-auth
4642

47-
docs:
48-
runs-on: ubuntu-latest
49-
steps:
50-
- name: Checkout
51-
uses: actions/checkout@v4
52-
- name: Install PIP Dependencies
53-
uses: actions/setup-python@v5
54-
with:
55-
cache: 'pip'
56-
- run: python -m pip install -r ./docs/requirements.txt
57-
- name: Build Docs
58-
run: |
59-
git fetch --tags
60-
cd docs
61-
mkdir _build
62-
python build_docs.py
63-
- name: Setup Pages
64-
uses: actions/configure-pages@v5
65-
- name: Upload artifact
66-
uses: actions/upload-pages-artifact@v3
67-
with:
68-
path: './pages'
69-
deploy:
70-
needs: docs
71-
72-
permissions:
73-
contents: read
74-
pages: write
75-
id-token: write
76-
77-
environment:
78-
name: github-pages
79-
url: ${{ steps.deployment.outputs.page_url }}
80-
81-
runs-on: ubuntu-latest
82-
83-
steps:
84-
- name: Deploy to GitHub Pages
85-
id: deployment
86-
uses: actions/deploy-pages@v4
87-
with:
88-
token: ${{ secrets.GITHUB_TOKEN }}
89-

docs/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build
2+
bin
3+
include
4+
lib
5+
lib64
6+
pyvenv.cfg
7+
.DS_Store

docs/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

docs/build_docs.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

docs/conf.py

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
"""config file for sphinx"""
1+
from sphinx.highlighting import lexers
2+
from pygments.lexers.web import PhpLexer
23

3-
import os
4-
import yaml
4+
lexers['php'] = PhpLexer(startinline=True, linenos=1)
5+
lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1)
56

67
# Configuration file for the Sphinx documentation builder.
78
#
@@ -11,75 +12,40 @@
1112
# -- Project information -----------------------------------------------------
1213
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1314

14-
project = "JWT-Auth"
15-
copyright = "2024, James Read"
16-
author = "James Read"
15+
project = 'jwt-auth'
16+
copyright = '2025, James Read'
17+
author = 'James Read'
18+
release = '1.1.0'
1719

1820
# -- General configuration ---------------------------------------------------
1921
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2022

2123
extensions = [
22-
"sphinx.ext.githubpages",
23-
"sphinx_multiversion",
24+
'sphinx.ext.autodoc',
25+
'sphinx.ext.doctest',
26+
'sphinx.ext.todo',
27+
'sphinx.ext.coverage',
28+
'sphinx.ext.imgmath',
29+
'sphinx.ext.viewcode',
30+
'sphinx.ext.githubpages',
31+
'sphinx.ext.napoleon',
32+
'sphinx_rtd_theme',
33+
'sphinx_multiversion',
2434
]
25-
templates_path = ["_templates"]
26-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "bin", "lib", "lib64"]
2735

28-
# -- Options for HTML output -------------------------------------------------
29-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
30-
31-
html_theme = "sphinx_rtd_theme"
32-
html_static_path = []
33-
html_baseurl = os.environ.get("pages_root")
34-
html_sidebars = {
35-
"**": ["versions.html"],
36-
}
37-
38-
locale_dirs = ["locale/"] # path is example but recommended.
39-
gettext_compact = False # optional.
40-
41-
language = os.environ.get("current_language")
42-
version = os.environ.get("current_version")
43-
44-
build_all_docs = os.environ.get("build_all_docs")
45-
pages_root = os.environ.get("pages_root", "/")
36+
templates_path = ['_templates']
37+
exclude_patterns = ['.venv', 'bin', 'build', 'include', 'lib','lib64']
4638

47-
html_context = {
48-
"current_language": language,
49-
"languages": [
50-
{"name": language, "url": f"/{version}/{language}"},
51-
],
52-
"current_version": {"name": version},
53-
"versions": {"tags": [], "branches": [{"name": "main", "url": pages_root}]},
54-
}
39+
root_doc = 'index'
5540

56-
57-
def meta(current_language: str) -> None:
58-
"""
59-
adds meta data to html_context versions
60-
"""
61-
with open("versions.yaml", "r", encoding="UTF-8") as yaml_file:
62-
docs = yaml.safe_load(yaml_file)
63-
for lang in docs[version].get("languages", []):
64-
found = next(
65-
(item for item in html_context["languages"] if item["name"] == lang),
66-
None,
67-
)
68-
if found is None:
69-
html_context["languages"].append(
70-
{
71-
"name": lang,
72-
"url": f"/{version}/{lang}",
73-
}
74-
)
75-
76-
for label, details in docs.items():
77-
html_context["versions"]["tags"].append(
78-
{
79-
"name": details.get("tag"),
80-
"url": f"/jwt-auth/{label}/{current_language}",
81-
}
82-
)
83-
84-
85-
meta(language)
41+
# -- Options for HTML output -------------------------------------------------
42+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
43+
html_theme = 'sphinx_rtd_theme'
44+
highlight_language = "php"
45+
46+
smv_tag_whitelist = r'^.*$'
47+
smv_branch_whitelist = r'^(\d\.x|main)$'
48+
smv_remote_whitelist = r'^origin$'
49+
smv_released_pattern = r'^tags/.*$'
50+
smv_outputdir_format = '{ref.name}'
51+
smv_prefer_remote_refs = False

docs/pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[project]
2+
name = "jimtools-jwt-auth"
3+
version = "3.0.0"
4+
description = "PSR 15 JWT Authentication middleware. Replacement for "
5+
readme = "../README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"pygments>=2.19.2",
9+
"sphinx>=8.1.3",
10+
"sphinx-multiversion>=0.2.4",
11+
"sphinx-rtd-theme>=3.0.2",
12+
]

docs/requirements.txt

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
alabaster==0.7.16
2-
Babel==2.15.0
3-
certifi==2024.2.2
4-
charset-normalizer==3.3.2
5-
click==8.1.7
6-
docutils==0.20.1
7-
idna==3.7
1+
alabaster==1.0.0
2+
babel==2.17.0
3+
certifi==2025.11.12
4+
charset-normalizer==3.4.4
5+
docutils==0.22.4
6+
idna==3.11
87
imagesize==1.4.1
9-
Jinja2==3.1.4
10-
MarkupSafe==2.1.5
11-
packaging==24.0
12-
Pygments==2.18.0
13-
PyYAML==6.0.1
14-
requests==2.32.3
15-
setuptools==70.0.0
16-
snowballstemmer==2.2.0
17-
Sphinx==7.3.7
18-
sphinx-intl==2.2.0
8+
Jinja2==3.1.6
9+
MarkupSafe==3.0.3
10+
packaging==25.0
11+
Pygments==2.19.2
12+
requests==2.32.5
13+
roman-numerals==4.1.0
14+
snowballstemmer==3.0.1
15+
Sphinx==9.0.4
1916
sphinx-multiversion==0.2.4
20-
sphinx-rtd-theme==2.0.0
21-
sphinxcontrib-applehelp==1.0.8
22-
sphinxcontrib-devhelp==1.0.6
23-
sphinxcontrib-htmlhelp==2.0.5
24-
sphinxcontrib-jquery==4.1
17+
sphinxcontrib-applehelp==2.0.0
18+
sphinxcontrib-devhelp==2.0.0
19+
sphinxcontrib-htmlhelp==2.1.0
2520
sphinxcontrib-jsmath==1.0.1
26-
sphinxcontrib-qthelp==1.0.7
27-
sphinxcontrib-serializinghtml==1.1.10
28-
urllib3==2.2.1
21+
sphinxcontrib-qthelp==2.0.0
22+
sphinxcontrib-serializinghtml==2.0.0
23+
urllib3==2.6.2
24+
uv==0.9.18

0 commit comments

Comments
 (0)