Skip to content

Commit 1714208

Browse files
committed
Add Cloudflare build script
1 parent 875cad8 commit 1714208

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

cloudflare_build.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
sudo apt-get update && sudo apt-get install -y graphviz libsasl2-dev libldap2-dev libssl-dev
5+
6+
python -m pip install --upgrade pip
7+
pip install -r requirements_for_docs.txt
8+
9+
git submodule update --init --recursive
10+
11+
DEFAULT_BRANCH="stable"
12+
CURRENT_BRANCH="${CF_PAGES_BRANCH:-$DEFAULT_BRANCH}"
13+
SAFE_BRANCH=$(echo "${CURRENT_BRANCH}" | sed 's/[^a-zA-Z0-9._-]/-/g' | cut -c1-50)
14+
15+
if [ "${CURRENT_BRANCH}" = "${DEFAULT_BRANCH}" ]; then
16+
export DOCS_VERSION=stable
17+
export DOCS_BASEURL=https://docs.openspp.org/
18+
export IS_PREVIEW=0
19+
else
20+
export DOCS_VERSION="${SAFE_BRANCH}"
21+
if [ -n "${CF_PAGES_URL:-}" ]; then
22+
export DOCS_BASEURL="${CF_PAGES_URL%/}/"
23+
else
24+
export DOCS_BASEURL="https://docs.openspp.org/previews/${SAFE_BRANCH}/"
25+
fi
26+
export IS_PREVIEW=1
27+
fi
28+
29+
sphinx-build -b html docs docs/_build/html
30+
cp docs/_static/_redirects docs/_build/html/_redirects || true

0 commit comments

Comments
 (0)