jj/.github/scripts/docs-build-deploy
Ilya Grigoriev 043f786fbf website: Stop mike from always changing sitemaps.xml.gz
Originally, my motivation was to try again to get `mike` to not push empty
commits (which this should do). I'm now reconsidering this, since *not* pushing
empty commits will make the output of the CI job a little harder to read. If
this becomes an issue, I  might even add `--allow-empty` to the `mike`
invocations later.

A more important motivation is that even for a 400-byte file, changing it for
every PR blows up the size of the repo eventually.

The cause for the changes to this file was that `gzip` stores a timestamp
inside the `.gz` file.
2023-11-06 17:10:27 -08:00

22 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
# Set up a virtual environment with the required tools, build, and deploy the docs.
#
# Run from the root directory of the project as
# .github/scripts/docs-build-deploy 'https://martinvonz.github.io' prerelease main
# All arguments after the first are passed to `mike deploy`, run
# `poetry run -- mike deploy --help` for options. Note that `mike deploy`
# creates a commit directly on the `gh-pages` branch.
set -ev
export "SITE_URL_FOR_MKDOCS=$1"; shift
# Affects the generation of `sitemap.xml.gz` by `mkdocs`. See
# https://github.com/jimporter/mike/issues/103 and
# https://reproducible-builds.org/docs/source-date-epoch/
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct docs/ mkdocs.yml)
# https://github.com/python-poetry/poetry/issues/1917 and
# https://github.com/python-poetry/poetry/issues/8623
export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring
poetry install --no-root # Only really needed once per environment unless there are updates
# TODO(ilyagr): The new default "alias-type" is symlink, we should consider
# switching to it.
poetry run -- mike deploy --alias-type redirect "$@"