-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (74 loc) · 1.98 KB
/
docs.yaml
File metadata and controls
85 lines (74 loc) · 1.98 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Docs
on:
push:
branches: [main]
paths:
- "docs/**"
- "mkdocs.yml"
- "src/fluxopt_plot/**"
pull_request:
paths:
- "docs/**"
- "mkdocs.yml"
workflow_dispatch:
inputs:
deploy:
description: "Deploy docs"
type: boolean
default: false
version:
description: "Version label (e.g. v0.1.0)"
type: string
required: false
workflow_call:
inputs:
deploy:
type: boolean
default: false
version:
type: string
required: false
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
docs:
name: Build & deploy docs
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync --group docs
- name: Build docs
run: uv run mkdocs build --strict
- name: Configure Git
if: github.event_name == 'push' || inputs.deploy
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Deploy dev docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !inputs.deploy
run: uv run mike deploy --push dev
- name: Deploy versioned docs
if: inputs.deploy && inputs.version != ''
env:
VERSION: ${{ inputs.version }}
run: |
VERSION=${VERSION#v}
if [[ "$VERSION" =~ (alpha|beta|rc) ]]; then
uv run mike deploy --push "$VERSION"
else
uv run mike deploy --push --update-aliases "$VERSION" latest
uv run mike set-default --push latest
fi