| 1 |
#!/bin/sh |
| 2 |
# Set up a virtual environment with the required tools, build, and deploy the docs. |
| 3 |
# |
| 4 |
# Run from the root directory of the project as |
| 5 |
# .github/scripts/docs-build-deploy prerelease main |
| 6 |
# All arguments after the first are passed to `mike deploy`, run |
| 7 |
# `uv run -- mike deploy --help` for options. Note that `mike deploy` |
| 8 |
# creates a commit directly on the `gh-pages` branch. |
| 9 |
set -ev |
| 10 |
|
| 11 |
# Affects the generation of `sitemap.xml.gz` by `mkdocs`. See |
| 12 |
# https://github.com/jimporter/mike/issues/103 and |
| 13 |
# https://reproducible-builds.org/docs/source-date-epoch/ |
| 14 |
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct docs/ mkdocs.yml) |
| 15 |
# TODO: `--alias-type symlink` is the |
| 16 |
# default, and may be nicer in some ways. However, |
| 17 |
# this requires deploying to GH Pages via a "custom GitHub Action", as in |
| 18 |
# https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow. |
| 19 |
# Otherwise, you get an error: |
| 20 |
# > Site contained a symlink that should be dereferenced: /main. |
| 21 |
# > For more information, see https://docs.github.com/github/working-with-github-pages/troubleshooting-jekyll-build-errors-for-github-pages-sites#config-file-error. |
| 22 |
uv run -- mike deploy --alias-type copy "$@" |