-
Notifications
You must be signed in to change notification settings - Fork 6
74 lines (71 loc) · 2.42 KB
/
mkdocs.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
name: Documentation
on:
workflow_call:
# Additional trigger to deploy changes to the documentation/ folder
# on push to main, ignoring tags so we don't trigger twice upon release
push:
branches:
- main
paths:
- documentation/**
tags-ignore:
- "*"
jobs:
mkdocs-prep:
# Runs the markdown linter to ensure we don't release faulty markdown.
# Also gets the correct major version, whether the job is triggered by a version tag
# or a push to main to update the latest documentation.
runs-on: ubuntu-latest
outputs:
major: ${{ steps.tagged_version.outputs.major || steps.current_version.outputs.major }}
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "16.x"
- run: npm ci --ignore-scripts
- if: startsWith(github.ref, 'refs/tags/v')
name: Get tagged version
id: tagged_version
uses: battila7/get-version-action@v2
- if: github.ref == 'refs/heads/main'
name: Get current version
id: current_version
run: |
VERSION=$(git show origin/main:package.json | jq -r .version | grep -Po '^(\d+)')
echo "major=$VERSION" >> $GITHUB_OUTPUT
mkdocs:
runs-on: ubuntu-latest
needs: mkdocs-prep
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: pip install mkdocs-material
- run: pip install mike
- run: git config user.name ci-bot
- run: git config user.email [email protected]
- run: git fetch origin gh-pages --depth=1
- run: |
cd documentation && mike deploy --push --update-aliases \
typedocs latest
typedocs:
# Build typedocs and publish them to the GH page.
# `mike deploy` overwrites the entire folder for a version so these need to be (re)built afterwards.
needs: [mkdocs-prep, mkdocs]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: "16.x"
- run: npm ci --ignore-scripts
- name: Generate typedocs
run: npm run typedocs
- name: Deploy typedocs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: ${{ needs.mkdocs-prep.outputs.major }}.x/docs