Skip to content

Update dependency mkdocs-material to v9.5.13 #383

Update dependency mkdocs-material to v9.5.13

Update dependency mkdocs-material to v9.5.13 #383

Workflow file for this run

name: Publish docs
on:
push:
branches:
- "[0-9]+.[0-9]+.x"
release:
types:
- published
jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Set up git author
uses: oleksiyrudenko/gha-git-credentials@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Find latest release
id: latest_release
uses: pozetroninc/[email protected]
with:
repository: ${{ github.repository }}
excludes: draft,prerelease
- name: Normalize current versions
id: current
uses: actions/github-script@v7
with:
script: return context.ref.match(/([0-9]+\.[0-9]+)\.(x|[0-9]+)/i)[1];
result-encoding: string
- name: Normalize latest versions
id: latest
uses: actions/github-script@v7
with:
script: return "${{steps.latest_release.outputs.release}}".match(/([0-9]+\.[0-9]+)\.[0-9]+/i)[1];
result-encoding: string
- name: Setup deploy key
env:
REPOSITORY_ACCESS_KEY: ${{ secrets.REPOSITORY_ACCESS_KEY }}
run: |
# Setup SSH deploy key
mkdir -p ~/.ssh
echo "${REPOSITORY_ACCESS_KEY}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H github.com > ~/.ssh/known_hosts
- run: git remote add doc [email protected]:patchlevel/event-sourcing-docs.git
- run: git fetch doc gh-pages --verbose
- run: |
if [ "${{ steps.current.outputs.result }}" = "${{ steps.latest.outputs.result }}" ]
then
# Here we deploy a new latest version
mike deploy ${{ steps.current.outputs.result }} latest --config-file docs/mkdocs.yml --update-aliases --push --remote doc
else
# Here we deploy a version that's not the latest one
mike deploy ${{ steps.current.outputs.result }} --config-file docs/mkdocs.yml --push --remote doc
fi
- run: |
# Check if the "latest" alias exists
HAS_LATEST=$(mike list --config-file docs/mkdocs.yml --rebase --remote doc | grep latest) || true
# If so then it is set as the default version (to enable the index redirect)
if [ "${HAS_LATEST}" != "" ]
then
echo "Set latest as default"
mike set-default latest --config-file docs/mkdocs.yml --remote doc
fi