-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·62 lines (49 loc) · 2.24 KB
/
build.sh
File metadata and controls
executable file
·62 lines (49 loc) · 2.24 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# Created with antsibull-docs 2.5.0.post0
set -e
pushd "$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
trap "{ popd; }" EXIT
# shellcheck source=versions.env
source versions.env
# Install Ansible Collections
echo "Installing Ansible Collections..."
ansible-galaxy collection install "arillso.system:${ARILLSO_SYSTEM_VERSION}" --force
ansible-galaxy collection install "arillso.agent:${ARILLSO_AGENT_VERSION}" --force
ansible-galaxy collection install "arillso.container:${ARILLSO_CONTAINER_VERSION}" --force
# Create collection documentation into temporary directory
rm -rf temp-rst
mkdir -p temp-rst
chmod og-w temp-rst # antsibull-docs wants that directory only readable by itself
antsibull-docs \
--config-file antsibull-docs.cfg \
collection \
--use-current \
--collection-version "arillso.system:${ARILLSO_SYSTEM_VERSION}" \
--collection-version "arillso.agent:${ARILLSO_AGENT_VERSION}" \
--collection-version "arillso.container:${ARILLSO_CONTAINER_VERSION}" \
--dest-dir temp-rst \
arillso.system arillso.agent arillso.container
# Copy collection documentation into source directory
rsync -cprv --delete-after temp-rst/collections/ rst/collections/
# Fix collection names to lowercase in all RST files
echo "Converting collection names to lowercase..."
find rst/collections/arillso -type f -name "*.rst" | while read -r file; do
sed -i 's/Arillso/arillso/g; s/\.Agent/\.agent/g; s/\.System/\.system/g; s/\.Container/\.container/g' "$file"
done
find rst -type f -name "*.rst" | while read -r file; do
sed -i 's/Arillso/arillso/g' "$file"
done
# Build Sphinx site
sphinx-build -M html rst build -c . -W --keep-going
# Optimize CSS and JS if postcss is available
if command -v postcss &> /dev/null && [ -f build/html/_static/custom.css ]; then
echo "Optimizing CSS with PostCSS (autoprefixer + cssnano)..."
postcss build/html/_static/custom.css \
--use autoprefixer --use cssnano \
--no-map \
-o build/html/_static/custom.css
echo "CSS optimization complete."
fi