Deploy docs #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy docs | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- docs/** | |
- mkdocs.yaml | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.event.repository.fork == false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Run generate cache key | |
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-cache-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs- | |
- name: Run setup mkdocs dependencies | |
run: pip install mkdocs mkdocs-material mkdocs-autolinks-plugin mkdocs-drawio-file mkdocs-git-revision-date-localized-plugin fontawesome_markdown mike pymdown-extensions | |
- name: Run mkdocs deployment | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
mike deploy -b gh-pages -p -F mkdocs.yaml -u next | |
- name: Run mkdocs release deployment | |
if: "contains(github.event.head_commit.message, 'docs: release')" | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
LATEST_TAG=$(git describe --abbrev=0) | |
SHORT_VERSION=${LATEST_TAG%.*} | |
mike deploy -b gh-pages -p -F mkdocs.yaml -u ${SHORT_VERSION} latest | |