-
Notifications
You must be signed in to change notification settings - Fork 143
99 lines (82 loc) · 2.37 KB
/
docs.yml
File metadata and controls
99 lines (82 loc) · 2.37 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Build and Publish Documentation
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: docs-deploy
cancel-in-progress: false
jobs:
check_docs:
name: Check documentation
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -e '.[dev]'
- name: Check documentation
run: |
rm -rf docs/build docs/_autosummary
make docs-check
deploy_docs:
name: Build and deploy documentation
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -e '.[dev]'
- name: Determine version slug
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
echo "slug=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
else
echo "slug=dev" >> "$GITHUB_OUTPUT"
fi
- name: Build documentation
env:
DOCS_VERSION: ${{ steps.version.outputs.slug }}
run: |
rm -rf docs/build docs/_autosummary
make docs
- name: Clean build artifacts
run: rm -rf docs/build/.doctrees docs/build/.buildinfo
- name: Deploy versioned docs
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build
destination_dir: ${{ steps.version.outputs.slug }}
publish_branch: docs
keep_files: true
cname: docs.pylabrobot.org
- name: Deploy stable
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build
destination_dir: stable
publish_branch: docs
keep_files: true
cname: docs.pylabrobot.org