Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README sphinx website generation #766

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we try this once in this branch just to see that it works, and then revert back to - master before merging?


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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, so this is going to publish the documentation at https://akaihola.github.io/darker?

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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These features will be included in the next release:

Added
-----
- Add readthedocs site
- New exit codes 2 for file not found, 3 for invalid command line arguments, 4 for
missing dependencies and 123 for unknown failures.
- Display exit code in parentheses after error message.
Expand Down
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