Skip to content

Commit

Permalink
README sphinx website generation
Browse files Browse the repository at this point in the history
* Made significantly easier and still used sphinx
* https://github.com/akaihola/darker/pull/url
  • Loading branch information
clintonsteiner committed Nov 22, 2024
1 parent ed005fa commit 09f17c5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/sphinx-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Sphinx build

on:
push:
branches:
- master

jobs:
sphinx-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.13'
cache: 'pip' # caching pip dependencies
- run: pip install .[release]

- name: Build HTML
run: ./action/build_docs.sh

- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: html-docs
path: ./sphinx_output/

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sphinx_output
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ __pycache__/
*.pyc
/.vscode/
/build
/sphinx_output
/venv
22 changes: 22 additions & 0 deletions action/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

THEME="sphinx_rtd_theme"
OUTPUT_DIR="../sphinx_output"
REPO_DIR=$PWD

mkdir -p ../sphinx_project/source
pushd ../sphinx_project

pip install $THEME

cat <<EOL > source/conf.py
project = "README"
html_theme = "$THEME"
EOL

cp "../README.rst" ../sphinx_project/source/index.rst
sphinx-build -b html source $OUTPUT_DIR

popd
mv ../sphinx_project/$OUTPUT_DIR .
rm -rf ../sphinx_project
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ test =
wheel>=0.21.0
release =
darkgray-dev-tools~=0.1.1
sphinx
sphinx-rtd-theme

[flake8]
# Line length according to Black rules
Expand Down

0 comments on commit 09f17c5

Please sign in to comment.