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

Documentation: Add initial docs setup #31

Merged
merged 8 commits into from
Dec 1, 2024
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Documentation

on:
push:
paths:
- "docs/**" # Only trigger when files in docs folder change
branches:
- "**"
pull_request:
paths:
- "docs/**" # Only trigger when files in docs folder change
branches:
- "**"

jobs:
build-docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: "pip"

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: |
pip install -e '.[docs]'

- name: Build Documentation
working-directory: ./docs
run: |
make html

- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: sphinx-docs
path: docs/_build/html/
retention-days: 7
31 changes: 31 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A sandbox project is included in this repository to aid in development.
- [Yarn](https://yarnpkg.com/)
- [Pre-commit](https://pre-commit.com/)
- [Caddy](https://caddyserver.com/) (optional, but recommended for https testing)
- [GNU](https://www.gnu.org)

## Installation (sandbox)

Expand Down Expand Up @@ -82,6 +83,36 @@ The pre-commit hooks will now run automatically when you try to commit changes.

pre-commit run --all-files

## Documentation

This project's documentation uses the [Sphinx](https://www.sphinx-doc.org) [Alabaster](https://alabaster.readthedocs.io/) theme.

To build the documentation, follow these steps:

1. Clone the repository:

```
git clone git@github.com:Stormbase/django-otp-webauthn.git
```

2. Navigate to the docs folder:

```
cd docs
```

3. Build the documentation:

```
make html
```

4. Serve it, and watch for changes:

```
make run
```

## Releasing

Releasing a new version is semi-automated. The following steps should be taken:
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build/
25 changes: 25 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Start a local development server to automatically rebuild and serve the HTML documentation
# whenever changes are made to the source files.
run:
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Empty file added docs/_static/.gitkeep
Empty file.
Empty file added docs/_templates/.gitkeep
Empty file.
39 changes: 39 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "Django OTP WebAuthn"
copyright = "2024"
author = "Stormbase and individual contributors"

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

extensions = []

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "venv"]

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]

# -- Customize Alabaster theme -----------------------------------------------
# https://alabaster.readthedocs.io/en/latest/index.html

html_theme_options = {
"description": "An implementation of WebAuthn Passkeys for Django",
"logo": "",
"github_banner": True,
"github_button": True,
"github_type": "star",
"github_user": "Stormbase",
"github_repo": "django-otp-webauthn",
"page_width": "97%",
}
Loading