-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (67 loc) · 2.28 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
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
name: docs
on:
pull_request_target:
types: [closed]
workflow_dispatch:
env:
PYTHON_VERSION: 3.11
permissions:
contents: write
id-token: write
pages: write
jobs:
documentation:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python runtime
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies, including dev dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --with dev
- name: Install mkdocs-material
run: poetry add mkdocs-material
- name: Build documentation
# `TZ=UTC` added as a workoround to make it work with `act`, see https://github.com/nektos/act/issues/1853#issuecomment-1620853901
run: |
TZ=UTC .venv/bin/mkdocs build --clean
.venv/bin/mkdocs --version
- name: Create OpenAPI Json file
run: .venv/bin/create_openapi
- name: Setup Node
uses: actions/setup-node@v4
- name: Build Redoc instance
run: npx @redocly/cli build-docs ./openapi.json --output=site/redoc/index.html
- name: Adjust permissions
run: |
chmod -c -R +rX site/ | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: site
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
- name: Save build cache
uses: actions/cache/save@v3
with:
key: brevia-docs-${{ hashfiles('.cache/**') }}
path: .cache