-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (96 loc) · 3.42 KB
/
docs.yaml
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
name: Docs CI
on:
push:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs.yaml'
release:
types:
- published
jobs:
docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
#----------------------------------------------
# checkout repo & set up python
#----------------------------------------------
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
#----------------------------------------------
# setup python
#----------------------------------------------
- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.11
#----------------------------------------------
# load poetry, if cached
#----------------------------------------------
- name: Load cached Poetry
id: cached-poetry-installation
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-cache-${{ runner.os }}-${{ env.POETRY_VERSION }}
#----------------------------------------------
# install poetry, if not cached
#----------------------------------------------
- name: Install Poetry
if: steps.cached-poetry-installation.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# install pandoc
#----------------------------------------------
- name: Install Pandoc
run: |
sudo apt-get install -y --no-install-recommends pandoc
#----------------------------------------------
# load docs dependencies, if cached
#
# Notes:
# 1. changes to the poetry.lock file will mean that
# this step is skipped and the next one will be executed instead
# 2. caching venv does not seem to work on Windows runners
#----------------------------------------------
- name: Load cached .venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: docs-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install docs dependencies, if not cached
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with=docs
#----------------------------------------------
# install project (always)
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# build docs
#----------------------------------------------
- name: Build docs
run: cd docs && make html
#----------------------------------------------
# publish docs to github pages
#----------------------------------------------
- name: Publish to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html