-
-
Notifications
You must be signed in to change notification settings - Fork 546
55 lines (47 loc) · 1.61 KB
/
Copy pathdocs.yml
File metadata and controls
55 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'docs-requirements.txt'
- '.github/workflows/docs.yml'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # release tags only, not -rc
pull_request:
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'docs-requirements.txt'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Configure git for mike
if: github.event_name != 'pull_request'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Build docs (PR check)
if: github.event_name == 'pull_request'
run: uv run --with-requirements docs-requirements.txt mkdocs build --strict
- name: Deploy as latest (main branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: uv run --with-requirements docs-requirements.txt mike deploy --push --update-aliases latest
- name: Deploy release version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
# Extract minor version from tag, e.g. v2.11.2 -> v2.11
VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's/\.[0-9]*$//')
uv run --with-requirements docs-requirements.txt mike deploy --push --update-aliases "${VERSION}" stable