This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
59 lines (47 loc) · 1.76 KB
/
docs.yml
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
name: Docs CI
on:
push:
pull_request:
jobs:
docs:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
python: ["3.10"]
runs-on: ubuntu-latest
steps:
- name: Avoid git conflicts when tag and branch pushed at same time
if: startsWith(github.ref, 'refs/tags')
run: sleep 60
- name: Install python version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Packages
# Can delete this if you don't use graphviz in your docs
run: sudo apt-get install graphviz
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: |
touch requirements_dev.txt
pip install -r requirements_dev.txt -e .[dev]
- name: Build docs
run: tox -e docs
- name: Move to versioned directory
# e.g. main or 0.1.2
run: mv build/html ".github/pages/${{ github.ref_name }}"
- name: Write switcher.json
run: python .github/pages/make_switcher.py --add "${{ github.ref_name }}" ${{ github.repository }} .github/pages/switcher.json
- name: Publish Docs to gh-pages
if: github.event_name == 'push'
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .github/pages
keep_files: true