Skip to content

Commit 845255e

Browse files
README sphinx website generation
* Made significantly easier and still used sphinx * https://github.com/akaihola/darker/pull/url
1 parent ed005fa commit 845255e

5 files changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/sphinx-build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Sphinx build
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
sphinx-build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.13'
17+
cache: 'pip' # caching pip dependencies
18+
- run: pip install .[release]
19+
20+
- name: Build HTML
21+
run: ./action/build_docs.sh
22+
23+
- name: Upload artifacts
24+
uses: actions/upload-artifact@v1
25+
with:
26+
name: html-docs
27+
path: ./sphinx_output/
28+
29+
- name: Deploy
30+
uses: peaceiris/actions-gh-pages@v3
31+
if: github.ref == 'refs/heads/master'
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./sphinx_output
35+
...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ __pycache__/
66
*.pyc
77
/.vscode/
88
/build
9+
/sphinx_output
910
/venv

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ These features will be included in the next release:
55

66
Added
77
-----
8+
- Add readthedocs site
89
- New exit codes 2 for file not found, 3 for invalid command line arguments, 4 for
910
missing dependencies and 123 for unknown failures.
1011
- Display exit code in parentheses after error message.

action/build_docs.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
THEME="sphinx_rtd_theme"
4+
OUTPUT_DIR="../sphinx_output"
5+
REPO_DIR=$PWD
6+
7+
mkdir -p ../sphinx_project/source
8+
pushd ../sphinx_project
9+
10+
pip install $THEME
11+
12+
cat <<EOL > source/conf.py
13+
project = "README"
14+
html_theme = "$THEME"
15+
EOL
16+
17+
cp "../README.rst" ../sphinx_project/source/index.rst
18+
sphinx-build -b html source $OUTPUT_DIR
19+
20+
popd
21+
mv ../sphinx_project/$OUTPUT_DIR .
22+
rm -rf ../sphinx_project

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ test =
8383
wheel>=0.21.0
8484
release =
8585
darkgray-dev-tools~=0.1.1
86+
sphinx
87+
sphinx-rtd-theme
8688

8789
[flake8]
8890
# Line length according to Black rules

0 commit comments

Comments
 (0)