Skip to content

Commit

Permalink
Deploy docs to GitHub Pages via GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelad committed Jan 9, 2024
1 parent b64ae8c commit 2a35f29
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: "Docs"

on:
release:
types: ["published"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "deploy-docs"
cancel-in-progress: false

env:
FORCE_COLOR: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PYTHON_VERSION: "3.11"

jobs:
build:
name: "Build docs"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"

- name: "Setup Python ${{ env.PYTHON_VERSION }}"
uses: "actions/setup-python@v4"
with:
python-version: "${{ env.PYTHON_VERSION }}"
cache: "pip"
cache-dependency-path: "requirements/*.txt"

- name: "Update pip and install Nox"
run: "python -m pip install pip nox -c requirements/constraints.txt"

- name: "Setup GitHub Pages"
uses: "actions/configure-pages@v4"

- name: "Build docs with 'docs' Nox session"
run: "nox -s docs"

- name: "Upload artifact"
uses: "actions/upload-pages-artifact@v3"
with:
path: "site/"

deploy:
name: "Deploy docs to GitHub Pages"
runs-on: "ubuntu-latest"
needs:
- "build"
environment:
name: "github-pages"
url: "${{ steps.deployment.outputs.page_url }}"
steps:
- name: "Deploy docs to GitHub Pages"
id: "deployment"
uses: "actions/deploy-pages@v4"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog], and this project adheres to
## Unreleased

### Added
- Deploy docs to GitHub Pages via GitHub Actions.
- Add MkDocs based docs.

## [v2.0.2](https://github.com/pawelad/fakester/releases/tag/v2.0.2) - 2023-04-02
Expand Down
13 changes: 13 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ def tests(session: nox.Session) -> None:
session.run("pytest", *dirs)


@nox.session()
def docs(session: nox.Session) -> None:
"""Build docs."""
# fmt: off
session.install(
"--no-deps",
"-r", "requirements/dev.txt",
)
# fmt: on

session.run("mkdocs", "build", "--strict")


@nox.session()
def code_style_checks(session: nox.Session) -> None:
"""Check code style."""
Expand Down

0 comments on commit 2a35f29

Please sign in to comment.