2021-06-03 18:20:40 +02:00
|
|
|
name: Deploy the documentation
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-06-18 20:26:25 +02:00
|
|
|
# For bleeding-edge documentation
|
2021-06-03 18:20:40 +02:00
|
|
|
- develop
|
2021-06-18 20:26:25 +02:00
|
|
|
# For documentation specific to a release
|
|
|
|
- 'release-v*'
|
2021-07-07 11:43:54 +02:00
|
|
|
# stable docs
|
|
|
|
- master
|
2021-06-03 18:20:40 +02:00
|
|
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2023-03-24 17:41:10 +01:00
|
|
|
pre:
|
|
|
|
name: Calculate variables for GitHub Pages deployment
|
2021-06-03 18:20:40 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-07-07 11:43:54 +02:00
|
|
|
# Figure out the target directory.
|
|
|
|
#
|
|
|
|
# The target directory depends on the name of the branch
|
|
|
|
#
|
|
|
|
- name: Get the target directory name
|
2021-06-18 20:26:25 +02:00
|
|
|
id: vars
|
|
|
|
run: |
|
2021-07-07 11:43:54 +02:00
|
|
|
# first strip the 'refs/heads/' prefix with some shell foo
|
|
|
|
branch="${GITHUB_REF#refs/heads/}"
|
2021-06-18 20:26:25 +02:00
|
|
|
|
2021-07-07 11:43:54 +02:00
|
|
|
case $branch in
|
|
|
|
release-*)
|
|
|
|
# strip 'release-' from the name for release branches.
|
|
|
|
branch="${branch#release-}"
|
|
|
|
;;
|
|
|
|
master)
|
|
|
|
# deploy to "latest" for the master branch.
|
|
|
|
branch="latest"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# finally, set the 'branch-version' var.
|
2022-10-18 14:45:34 +02:00
|
|
|
echo "branch-version=$branch" >> "$GITHUB_OUTPUT"
|
2023-03-24 17:41:10 +01:00
|
|
|
outputs:
|
|
|
|
branch-version: ${{ steps.vars.outputs.branch-version }}
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
pages-docs:
|
|
|
|
name: GitHub Pages
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- pre
|
|
|
|
steps:
|
2023-09-25 17:39:54 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-11-28 17:01:24 +01:00
|
|
|
with:
|
|
|
|
# Fetch all history so that the schema_versions script works.
|
|
|
|
fetch-depth: 0
|
2023-03-24 17:41:10 +01:00
|
|
|
|
|
|
|
- name: Setup mdbook
|
|
|
|
uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
|
|
|
|
with:
|
|
|
|
mdbook-version: '0.4.17'
|
|
|
|
|
2023-11-28 17:01:24 +01:00
|
|
|
- name: Setup python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: "3.x"
|
|
|
|
|
|
|
|
- run: "pip install 'packaging>=20.0' 'GitPython>=3.1.20'"
|
|
|
|
|
2023-03-24 17:41:10 +01:00
|
|
|
- name: Build the documentation
|
|
|
|
# mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
|
|
|
|
# However, we're using docs/README.md for other purposes and need to pick a new page
|
|
|
|
# as the default. Let's opt for the welcome page instead.
|
|
|
|
run: |
|
|
|
|
mdbook build
|
|
|
|
cp book/welcome_and_overview.html book/index.html
|
|
|
|
|
2021-07-07 11:43:54 +02:00
|
|
|
# Deploy to the target directory.
|
|
|
|
- name: Deploy to gh pages
|
2023-04-03 09:08:28 +02:00
|
|
|
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
|
2021-06-18 20:26:25 +02:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./book
|
2023-03-24 17:41:10 +01:00
|
|
|
destination_dir: ./${{ needs.pre.outputs.branch-version }}
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
pages-devdocs:
|
|
|
|
name: GitHub Pages (developer docs)
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- pre
|
|
|
|
steps:
|
2023-09-25 17:39:54 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-03-24 17:41:10 +01:00
|
|
|
|
|
|
|
- name: "Set up Sphinx"
|
|
|
|
uses: matrix-org/setup-python-poetry@v1
|
|
|
|
with:
|
|
|
|
python-version: "3.x"
|
|
|
|
poetry-version: "1.3.2"
|
|
|
|
groups: "dev-docs"
|
|
|
|
extras: ""
|
|
|
|
|
|
|
|
- name: Build the documentation
|
|
|
|
run: |
|
|
|
|
cd dev-docs
|
|
|
|
poetry run make html
|
|
|
|
|
|
|
|
# Deploy to the target directory.
|
|
|
|
- name: Deploy to gh pages
|
2023-04-03 09:08:28 +02:00
|
|
|
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
|
2023-03-24 17:41:10 +01:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./dev-docs/_build/html
|
|
|
|
destination_dir: ./dev-docs/${{ needs.pre.outputs.branch-version }}
|