Skip to content

[pre-commit.ci] auto fixes from pre-commit.com hooks #242

[pre-commit.ci] auto fixes from pre-commit.com hooks

[pre-commit.ci] auto fixes from pre-commit.com hooks #242

Workflow file for this run

---
on:
push:
workflow_dispatch:
inputs:
ref:
description: "The commit SHA, tag, or branch to publish. Uses the default branch if not specified."
default: ""
type: string
release:
types: [published]
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.12"
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: 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_name == 'main' && github.ref_type == 'branch'
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: github.ref_type == 'tag' && github.event_name == 'push'
run: |
pdm run mike deploy ${{ github.ref_name }} latest --push --update-aliases
pdm run mike set-default latest --push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy docs (Released published)
if: github.event_name == 'release' && github.event.action == 'published' && github.ref_type == 'tag'
run: |
# Version from tag, keep leading v, from github.ref workflow variable
pdm run mike deploy ${{ github.ref_name }} latest --push --update-aliases
pdm run mike set-default latest --push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}