-
Notifications
You must be signed in to change notification settings - Fork 160
159 lines (139 loc) · 4.88 KB
/
documentation.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: docswithmkdoc
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
# files that affect the docs build:
- docs/**
- CONTRIBUTING.md
- mkdocs.yml
workflow_dispatch:
jobs:
generate-files:
runs-on: ubuntu-20.04
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.9.10
#----------------------------------------------
# -- save a few section by caching poetry --
#----------------------------------------------
- name: Load cached Poetry installation
uses: actions/cache@v2
with:
path: ~/.local # the path depends on the OS
key: poetry-0 # increment to reset cache
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: '1.7.0'
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-00
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Generate comparison/level library dialect + dataset tables
run: |
source .venv/bin/activate
mv scripts/generate_dialect_comparison_docs.py generate_dialect_comparison_docs.py
mv scripts/generate_dataset_docs.py generate_dataset_docs.py
python generate_dialect_comparison_docs.py
python generate_dataset_docs.py
- name: Upload generated docs files
uses: actions/upload-artifact@v3
with:
name: generated_files
path: docs/includes/generated_files
build:
runs-on: ubuntu-latest
needs: generate-files
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: generated_files
path: docs/includes/generated_files
- run: tree docs/
- name: install docs dependencies
run: |
pip install --upgrade pip
pip install -r scripts/docs-requirements.txt
- name: build documentation
run: mkdocs build
- name: check links
uses: lycheeverse/[email protected]
with:
fail: true
args: --offline site/ --verbose './**/*.html'
- name: Upload built site
uses: actions/upload-artifact@v3
with:
name: built_site
path: site
# some environment info:
- run: pip freeze
- run: mkdocs --version
deploy:
runs-on: ubuntu-latest
needs: build
# we only deplot on push to master
# this job doesn't run if this is triggered by a PR
if: github.event_name == 'push'
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: built_site
path: site
- name: commit and force-push to gh-pages branch
run: |
pip install ghp-import==2.1.0
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
ghp-import -opfm "Update docs from commit ${{ github.sha }}" site