forked from pyinfra-dev/pyinfra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_public_docs.sh
executable file
·37 lines (27 loc) · 1.05 KB
/
build_public_docs.sh
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
#!/bin/bash
set -euo pipefail
# Generates /en/next
NEXT_BRANCH="3.x"
# Generates /en/latest AND redirects /page -> /en/$NAME
LATEST_BRANCH="2.x"
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
TAG_NAME=$(git tag --points-at HEAD)
echo "branch=${BRANCH_NAME}"
echo "tag=${TAG_NAME}"
if [ "${BRANCH_NAME}" = "${NEXT_BRANCH}" ]; then
echo "Building next docs (${NEXT_BRANCH})"
env DOCS_VERSION=next sphinx-build -a docs/ docs/public/en/next/
fi
if [ "${BRANCH_NAME}" = "${LATEST_BRANCH}" ]; then
echo "Building latest docs (${LATEST_BRANCH})"
env DOCS_VERSION=latest sphinx-build -a docs/ docs/public/en/latest/
fi
if [ -n "${TAG_NAME}" ] && [[ "$TAG_NAME" =~ ^v[0-9]\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "Building ${BRANCH_NAME} docs for tag: ${TAG_NAME}"
env DOCS_VERSION=$BRANCH_NAME sphinx-build -a docs/ docs/public/en/$BRANCH_NAME/
if [ "${BRANCH_NAME}" = "${LATEST_BRANCH}" ]; then
echo "Generating /page redirects"
env DOCS_VERSION=$BRANCH_NAME python scripts/generate_redirect_pages.py
fi
fi
echo "Docs build complete"