-
-
Notifications
You must be signed in to change notification settings - Fork 54
74 lines (65 loc) · 2.39 KB
/
generate-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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#----------------------------------------------
# Generate and upload documentation (only on push to master)
#----------------------------------------------
name: Generate documentation
on:
pull_request:
# on pull request we just want to build to see nothing is broken
paths:
- "README.md"
- "doc/**"
- ".github/workflows/generate-docs.yml"
- "mkdocs.yml"
push:
branches:
- master
jobs:
publish-docs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.9]
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Setup Python version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Generate documentation
run: bash ./build_mkdocs.sh
# generating openapi documentation
# we do this after mkdocs to overwrite api.html file
- name: Generate openapi html with ghcr.io/redocly/redoc/cli:latest
run : |
docker run --rm \
-v $(pwd)/doc/references:/data -v $(pwd)/gh_pages/:/output \
ghcr.io/redocly/redoc/cli:latest \
build -o /output/references/api/index.html api.yml && \
sudo chown $UID -R gh_pages
# Deploy docs to gh_pages if we are pushing to master
# Example from https://github.com/marketplace/actions/deploy-to-github-pages
- name: Deploy 🚀
# we only deploy on push to master
if: |
github.event_name == 'push' && github.event.ref == 'refs/heads/master'
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: gh_pages # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch