Skip to content

MkDocs Deploy

Reusable workflow that builds an MkDocs site and deploys it to GitHub Pages using the official GitHub Pages actions.

The workflow runs in two jobs: docs-build compiles the site and uploads the artifact, then docs-deploy publishes it to GitHub Pages.

Inputs

Name Type Default Description
python-version string 3.x Python version to use
mkdocs-packages string mkdocs-material Space-separated list of pip packages to install
## Caller Permissions

The calling workflow must set:

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

Concurrency

Since this workflow deploys to GitHub Pages, it is recommended to set concurrency in the calling workflow to avoid overlapping deployments:

concurrency:
  group: pages
  cancel-in-progress: false

Usage

name: Mkdocs Build and Deploy

on:
  push:
    branches: [main]

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

concurrency:
  group: pages
  cancel-in-progress: false

jobs:
  mkdocs-deploy:
    uses: AutomationDojo/reusable-cicd/.github/workflows/mkdocs_deploy.yml@main

With custom packages

name: Mkdocs Build and Deploy

on:
  push:
    branches: [main]

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

jobs:
  mkdocs-deploy:
    uses: AutomationDojo/reusable-cicd/.github/workflows/mkdocs_deploy.yml@main
    with:
      mkdocs-packages: "mkdocs-material mkdocs-minify-plugin"