Skip to content

Commit

Permalink
docs: prepare docs creation on release
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed Apr 8, 2022
1 parent 9ade021 commit 03fe9bc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,25 @@ jobs:
- name: Lint
run: tox -e package -e lint -e pyupgrade

# Build docs
docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install deps
run: pip install -e . && pip install sphinx
- name: Build docs
run: sphinx-build -b html docs docs/build

# Create a new semantic release
# Only runs on the original repo, not forks
release:
if: github.repository_owner == 'stephenmcd'
needs: [test, lint]
needs: [test, lint, docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
22 changes: 11 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,24 @@
import sys
from datetime import datetime

import cartridge

if "DJANGO_SETTINGS_MODULE" not in os.environ:
docs_path = os.getcwd()
cartridge_path_parts = (docs_path, "..")
sys.path.insert(0, docs_path)
sys.path.insert(0, os.path.realpath(os.path.join(*cartridge_path_parts)))
os.environ["DJANGO_SETTINGS_MODULE"] = "docs_settings"
# Django 1.7's setup is required before touching translated strings.
import django

try:
django.setup()
except AttributeError: # < 1.7
pass
django.setup()

# When a full build is run (eg from the root of the repo), we
# run all the Mezzanine utils for dynamically generated docs.
if sys.argv[-2:] == ["docs", "docs/build"]:
from mezzanine.utils import docs

import cartridge

docs.build_settings_docs(docs_path, prefix="SHOP_")
docs.build_changelog(docs_path, package_name="cartridge")
# docs.build_modelgraph(docs_path, package_name="cartridge")

try:
Expand Down Expand Up @@ -76,7 +73,6 @@

# General information about the project.
project = "Cartridge"

copyright = "2009 - %s, Stephen McDonald" % datetime.now().year

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -105,6 +101,11 @@
# for source files.
exclude_trees = ["_build"]

# List of files to be excluded when looking for source files.
#  Added settings.rst its still will be included in configuration.rst
#  only that prevents error of duplicate reference labels.
exclude_patterns = ["settings.rst"]

# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None

Expand Down Expand Up @@ -159,7 +160,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down Expand Up @@ -232,6 +233,5 @@
# latex_use_modindex = True


html_use_index = False
html_theme_path = ["."]
html_theme = "mezzanine_theme"
4 changes: 2 additions & 2 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Default: ``10.0``

Default tax rate in % when no custom tax handling is implemented.

Default: ``0``
Default: ``0.0``

.. _SHOP_DISCOUNT_FIELD_IN_CART:

Expand Down Expand Up @@ -268,4 +268,4 @@ Default: ``True``

Show the links to the wishlist, and allow adding products to it.

Default: ``True``
Default: ``True``

0 comments on commit 03fe9bc

Please sign in to comment.