Add mkdocs mike for versions #91
Workflow file for this run
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: # yamllint disable-line rule:truthy | |
pull_request: | |
branches: | |
- main | |
push: | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
pip install mkdocs mkdocs-material mike \ | |
mkdocs-awesome-pages-plugin beautifulsoup4 lxml | |
- name: Copy all to docs folder | |
run: | | |
mkdir -p docs | |
shopt -s extglob | |
mv !(docs) docs/ | |
- name: Deploy documentation | |
run: | | |
if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
VERSION=${{ github.ref_name }} | |
fi | |
VERSION=v2.7.2 | |
export BASE_URL=${BASE_URL}/${VERSION:-main} | |
VERSION=${VERSION%.*} | |
mike deploy -F .github/mkdocs.yaml \ | |
--push --branch gh-pages-mike \ | |
${VERSION:-main} ${VERSION:+latest} | |
mike set-default --push latest \ | |
--branch gh-pages-mike -F .github/mkdocs.yaml | |
if [[ -n ${VERSION} ]]; then | |
mike alias -F .github/mkdocs.yaml \ | |
--push --branch gh-pages-mike \ | |
${VERSION} latest | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_COMMITTER_NAME: ci-bot | |
GIT_COMMITTER_EMAIL: [email protected] | |
BASE_URL: https://github.com/SciCatProject/scicatlive/blob |