-
Notifications
You must be signed in to change notification settings - Fork 176
75 lines (65 loc) · 2.58 KB
/
book.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
# Performs checks, builds and deploys the documentation mdbook.
#
# Flow is based on the official github and mdbook documentation:
#
# https://github.com/actions/starter-workflows/blob/main/pages/mdbook.yml
# https://github.com/rust-lang/mdBook/wiki/Automated-Deployment%3A-GitHub-Actions
name: book
# Documentation should be built and tested on every pull-request, and additionally deployed on push onto next.
on:
workflow_dispatch:
pull_request:
path: ['docs/**']
push:
branches: [next]
path: ['docs/**']
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Always build and test the mdbook documentation whenever the docs folder is changed.
#
# The documentation is uploaded as a github artifact IFF it is required for deployment i.e. on push into next.
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
# Installation from source takes a fair while, so we install the binaries directly instead.
- name: Install mdbook and plugins
uses: taiki-e/install-action@v2
with:
tool: mdbook, mdbook-linkcheck, mdbook-alerts, mdbook-katex
- name: Build book
run: mdbook build docs/
# Only Upload documentation if we want to deploy (i.e. push to next).
- name: Setup Pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
id: pages
uses: actions/configure-pages@v5
- name: Upload book artifact
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
uses: actions/upload-pages-artifact@v3
with:
# We specify multiple [output] sections in our book.toml which causes mdbook to create separate folders for each. This moves the generated `html` into its own `html` subdirectory.
path: ./docs/book/html
# Deployment job only runs on push to next.
deploy:
name: Deploy documentation
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4