-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation CI to target Github Pages
Use embedded script instead of 'Lowdown' to handle changelog, as it doesn't seem to be maintained.
- Loading branch information
Showing
11 changed files
with
232 additions
and
27 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,55 @@ | ||
name: docs-deploy | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Create Build Environment | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -r ${GITHUB_WORKSPACE}/doc/requirements.txt | ||
mkdir -p ${{runner.workspace}}/build | ||
- name: Build documentation | ||
run: | | ||
sphinx-build -T -E -b html \ | ||
"${GITHUB_WORKSPACE}/doc" \ | ||
"${{runner.workspace}}/build" | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: ${{runner.workspace}}/build | ||
|
||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file was deleted.
Oops, something went wrong.
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
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,92 @@ | ||
from datetime import datetime | ||
|
||
from docutils import nodes | ||
from docutils.parsers.rst import directives | ||
from sphinx.util.docutils import SphinxDirective | ||
|
||
|
||
class ReleaseDirective(SphinxDirective): | ||
has_content = True | ||
required_arguments = 1 | ||
optional_arguments = 0 | ||
option_spec = { | ||
"date": directives.unchanged_required | ||
} | ||
|
||
def run(self): | ||
"""Creates a section for release notes with version and date.""" | ||
version = self.arguments[0] | ||
|
||
# Fetch today's date as default if no date is provided | ||
today_date_str = datetime.now().strftime("%Y-%m-%d") | ||
date_str = self.options.get("date", today_date_str) | ||
|
||
try: | ||
parsed_date = datetime.strptime(date_str, "%Y-%m-%d") | ||
release_date = parsed_date.strftime("%e %B %Y") | ||
except ValueError: | ||
raise ValueError(f"Invalid date format: {date_str}") | ||
|
||
# Create the version title node | ||
version_node = nodes.strong(text=version) | ||
section_title = nodes.title("", "", version_node) | ||
|
||
# Create the section node with a specific ID | ||
section_id = f"release-{version.replace(' ', '-')}" | ||
section = nodes.section( | ||
"", section_title, | ||
ids=[section_id], | ||
classes=["changelog-release"] | ||
) | ||
|
||
# Append formatted date | ||
section.append( | ||
nodes.emphasis(text=release_date, classes=["release-date"]) | ||
) | ||
|
||
# Parse content into a list of changes | ||
content_node = nodes.Element() | ||
self.state.nested_parse(self.content, self.content_offset, content_node) | ||
|
||
# Create a bullet list of changes | ||
changes_list = nodes.bullet_list("", classes=["changelog-change-list"]) | ||
for child in content_node: | ||
item = nodes.list_item("") | ||
item.append(child) | ||
changes_list.append(item) | ||
|
||
section.append(changes_list) | ||
|
||
return [section] | ||
|
||
|
||
class ChangeDirective(SphinxDirective): | ||
has_content = True | ||
required_arguments = 1 | ||
optional_arguments = 0 | ||
|
||
def run(self): | ||
"""Generates a categorized list item for a changelog entry.""" | ||
category = self.arguments[0] | ||
|
||
# Create a paragraph for the category with specific styling | ||
class_name = f"changelog-category-{category.lower().replace(' ', '-')}" | ||
category_node = nodes.inline( | ||
"", category, | ||
classes=["changelog-category", class_name] | ||
) | ||
paragraph_node = nodes.paragraph("", "", category_node) | ||
|
||
# Parse the detailed content under the category | ||
content_node = nodes.container() | ||
self.state.nested_parse(self.content, 0, content_node) | ||
paragraph_node += content_node | ||
|
||
return [paragraph_node] | ||
|
||
|
||
def setup(app): | ||
"""Register extension with Sphinx.""" | ||
app.add_directive("release", ReleaseDirective) | ||
app.add_directive("change", ChangeDirective) | ||
|
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,63 @@ | ||
.changelog-release { | ||
position: relative; | ||
} | ||
|
||
.changelog-release > h1, h2, h3, h4, h5 { | ||
margin-bottom: 5px; | ||
} | ||
|
||
.changelog-release em.release-date { | ||
color: #999; | ||
position: absolute; | ||
line-height: 2.5em; | ||
top: 0; | ||
right: 0; | ||
} | ||
|
||
.changelog-release ul.changelog-change-list { | ||
list-style: outside none none; | ||
} | ||
|
||
.changelog-release ul.changelog-change-list > li { | ||
list-style: outside none none; | ||
position: relative; | ||
margin: 0; | ||
padding: 8px 0 2px 120px; | ||
border-top: 1px solid #D6D6D6; | ||
} | ||
|
||
.rst-content .section .changelog-change-list ul li { | ||
list-style: initial; | ||
} | ||
|
||
.changelog-category { | ||
border-right: 3px solid #CCC; | ||
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05), 0px -1px 0px rgba(0, 0, 0, 0.05) inset; | ||
color: #333; | ||
display: inline-block; | ||
font-size: 0.7em; | ||
font-style: normal; | ||
font-weight: bold; | ||
line-height: 14px; | ||
padding: 4px 2px 4px 10px; | ||
text-shadow: 1px 1px 0px #FFF; | ||
text-transform: uppercase; | ||
width: 102px; | ||
position: absolute; | ||
top: 10px; | ||
left: 0px; | ||
background-color: #f8f8f8; | ||
} | ||
|
||
.changelog-category-fixed { | ||
border-color: #7C0; | ||
} | ||
|
||
.changelog-category-new { | ||
border-color: #11B0E9; | ||
} | ||
|
||
.changelog-category-changed { | ||
border-color: #EB3F3F; | ||
} | ||
|
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
Binary file not shown.
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
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
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
Lowdown==0.2.1 | ||
Sphinx==5.1.1 | ||
sphinx-rtd-theme==1.0.0 | ||
Sphinx==7.3.7 | ||
sphinx-rtd-theme==2.0.0 |
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