Skip to content

Mkdocs to GH-Pages

Mkdocs to GH-Pages #8

Workflow file for this run

name: Deploy Documentation
on:
push:
branches:
- master
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
deploy-docs:
name: Deploy Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: |
pip install mkdocs-material mike
- name: Generate changelog for dev
if: github.ref == 'refs/heads/master'
run: |
chmod +x .github/scripts/generate-changelog.sh
.github/scripts/generate-changelog.sh docs/changelog/dev.md
- name: Deploy dev version (master)
if: github.ref == 'refs/heads/master'
run: |
mike deploy --push --update-aliases dev latest
- name: Generate changelog for tagged version
if: startsWith(github.ref, 'refs/tags/')
run: |
chmod +x .github/scripts/generate-changelog.sh
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
.github/scripts/generate-changelog.sh "docs/changelog/$VERSION.md" "$TAG_NAME"
- name: Deploy tagged version
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
# Check if this is a pre-release (contains -, alpha, beta, rc)
if [[ "$VERSION" =~ - ]]; then
echo "Deploying pre-release version: $VERSION"
mike deploy --push "$VERSION"
else
echo "Deploying stable version: $VERSION"
mike deploy --push --update-aliases "$VERSION" stable
mike set-default --push stable
fi