docs: add multiversioned documentation (#344)

Documentation is now published on the `gh-pages` branch.

The branch will have a folder `docs` containing the following structure:
- `./docs` the copy from the `main` docs, but only used for the `index.html` page to do the multi-version routing.
- `./docs/main` the copy from the `main` branch docs folder
- `./docs/beta` the copy from the `beta` branch docs folder

Closes #332
This commit is contained in:
Alexis Couvreur
2024-07-03 14:56:59 -04:00
committed by GitHub
parent c1d578d6ab
commit 7ebfdd50ff
16 changed files with 128 additions and 59 deletions

44
.github/workflows/pages.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Github Pages
on:
push:
branches:
- main
- beta
paths:
- '.github/workflows/pages.yml'
- 'docs/**'
env:
# Publish the main documentation in 'docs/main' folder, and the beta in 'docs/beta'
# Routing and version selection is handled in the main documentation.
DESTINATION_DIR: ${{ github.ref == 'refs/heads/main' && 'docs/main' || 'docs/beta' }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Deploy index.html
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: docs
# Subfolders docs/main and docs/beta will contain the actual versioned documentation.
# This is just to have the rooting properly done at the root.
keep_files: true
- name: Deploy versioned documentation
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: ${{ env.DESTINATION_DIR }}
keep_files: false