-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (61 loc) · 2.1 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
---
name: MkDocs
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"
# Fetch the entire git history (all branches + tags)
# We do this because the docs use git describe, which requires having all
# the commits up to the latest version tag.
# We also need the gh-pages branch to push the docs to.
fetch-depth: 0
# Make the github application be the committer
# (see: https://stackoverflow.com/a/74071223 on how to obtain the committer email)
- name: Setup git config
run: |
git config --global user.name "py-mine-ci-bot"
git config --global user.email "121461646+py-mine-ci-bot[bot]@users.noreply.github.com"
- name: Setup poetry
id: poetry_setup
uses: ItsDrike/setup-poetry@v1
with:
python-version: 3.12
install-args: "--only main,docs"
- name: Build the documentation (mkdocs - PR preview)
if: ${{ github.event_name == 'pull_request' }}
run: poetry run mkdocs build
- name: Deploy docs - PR preview
if: ${{ github.event_name == 'pull_request' }}
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./site
preview-branch: gh-pages
umbrella-dir: pr-preview
token: ${{ steps.app-token.outputs.token }}
- name: Build the documentation (mike)
if: ${{ github.event_name == 'push' }}
run: poetry run mike deploy latest
- name: Deploy docs - latest
if: ${{ github.event_name == 'push' }}
run: git push origin gh-pages