Skip to content

maintainerr-release #137

maintainerr-release

maintainerr-release #137

Workflow file for this run

name: Mkdocs Deploy
on:
repository_dispatch:
types: [maintainerr-release]
workflow_dispatch:
inputs:
versionInput:
description: 'Input version from Maintainerr release'
required: true
isDev:
description: 'Is this a dev version?'
required: true
type: boolean
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || github.ref}}
sparse-checkout: |
docs
layouts
- name: Validate Version Input
run: |
VERSION="${{ github.event.inputs.versionInput || github.event.client_payload.versionInput }}"
if [[ ! "$VERSION" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "Invalid version format: '$VERSION'"
echo "Allowed characters: letters, numbers, dots (.), hyphens (-), and underscores (_)"
exit 1
fi
echo "Version format is valid: $VERSION"
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: sudo apt-get install pngquant
- run: pip install mkdocs-glightbox
- run: pip install mkdocs-swagger-ui-tag
- run: pip install "mkdocs-material[imaging]"
- run: pip install mike
- run: pip install mkdocs-git-revision-date-localized-plugin
- run: pip install mkdocs-git-committers-plugin-2
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
- name: Deploy Documentation
run: |
VERSION="${{ github.event.inputs.versionInput || github.event.client_payload.versionInput }}"
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
mike deploy --update-aliases "$VERSION" latest
else
if [ "${{ github.event.inputs.isDev }}" == "false" ]; then
mike deploy --update-aliases "$VERSION" latest
else
mike deploy --push --update-aliases "$VERSION" dev
fi
fi
- name: Set Default Version to Latest
if: github.event_name == 'repository_dispatch' || github.event.inputs.isDev == 'false'
run: mike set-default --push --allow-empty latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}