docs-deploy¶
Deploys MkDocs documentation using mike for versioned documentation. Handles git configuration, version detection, and mike deploy/set-default.
Usage¶
- uses: wphillipmoore/standard-actions/actions/docs-deploy@develop
with:
version-command: cat VERSION | cut -d. -f1,2
mkdocs-config: docs/site/mkdocs.yml
mike-command: mike
checkout-common: "false"
checkout-common-ref: develop
Inputs¶
| Name | Required | Default | Description |
|---|---|---|---|
version-command |
Yes | — | Shell command to extract the version string on main (e.g. cat VERSION, grep -oP ... version.go). |
mkdocs-config |
No | docs/site/mkdocs.yml |
Path to mkdocs.yml configuration file. |
mike-command |
No | mike |
Command to run mike. Set to uv run mike for Python repos that manage their own dependencies. When not mike, the action skips Python setup and MkDocs installation. |
checkout-common |
No | false |
Whether to checkout mq-rest-admin-common. |
checkout-common-ref |
No | develop |
Ref to checkout for mq-rest-admin-common. |
Permissions¶
contents: write(required for pushing to thegh-pagesbranch)
Behavior¶
- Checkout common (optional) — If
checkout-commonistrue, checks out themq-rest-admin-commonrepository for shared documentation fragments. - Set up Python 3.12 — Only when
mike-commandismike(default). - Install MkDocs and mike —
pip install mkdocs-material mike. Skipped when a custommike-commandis provided. - Configure git identity — Sets the git user to
github-actions[bot]for the deploy commit. - Determine version — On
main, runs theversion-commandto extract the version and setsalias=latest. On all other branches, setsversion=devwith no alias. - Deploy docs — On
main, runsmike deploy --push --update-aliases <version> latestfollowed bymike set-default --push latest. On other branches, runsmike deploy --push dev.
Examples¶
Standard library deployment¶
name: Documentation
on:
push:
branches: [develop, main]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: wphillipmoore/standard-actions/actions/docs-deploy@develop
with:
version-command: cat VERSION | cut -d. -f1,2
Python repo with uv-managed dependencies¶
- uses: wphillipmoore/standard-actions/actions/docs-deploy@develop
with:
version-command: cat VERSION | cut -d. -f1,2
mike-command: uv run mike
GitHub configuration¶
- GitHub Pages — Enable GitHub Pages in repository settings with source set
to Deploy from a branch and branch set to
gh-pages. - The
gh-pagesbranch is created automatically bymike deploy --pushon first run.