Skip to content

ci: enable PDM lockfile updates #8

ci: enable PDM lockfile updates

ci: enable PDM lockfile updates #8

Workflow file for this run

---
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
name: Mkdocs CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.11"
jobs:
docs:
name: Test, build and deploy docs
env:
PYTHONDEVMODE: 1
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PDM
uses: pdm-project/setup-pdm@main
id: setup-pdm
with:
python-version: ${{ matrix.python-version }}
cache: true
allow-python-prereleases: true
- name: Install dependencies
run: pdm install -v && pdm info
- name: "Check for mkdocs build --strict"
run: |
pdm run docs-build --strict
# If pull request or not main branch and not a tag
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch'
- name: Patch mike 2.0.0
run: |
# In .venv/lib/python3.11/site-packages/mike/mkdocs_utils.py, replace `config = mkdocs.utils.yaml_load(f)` by `config = mkdocs.config.load_config(f).data`
# Issue: https://github.com/jimporter/mike/issues/199
sed -i 's/config = mkdocs.utils.yaml_load(f)/config = mkdocs.config.load_config(f).data/' .venv/lib/python3.11/site-packages/mike/mkdocs_utils.py
- name: Configure git
run: |
git config user.email "[email protected]"
git config user.name "FireFighter Release CI"
- name: Deploy docs (dev)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
export SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
pdm run mike deploy dev --update-aliases --title "dev (${SHORT_SHA})" --push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy docs (tag)
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
pdm run mike deploy ${{ github.ref }} latest --push --update-aliases
pdm run mike set-default latest --push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}