#!/usr/bin/env bash set -euo pipefail conda_env_name="doxygen-awesome-css-docs" environment_file="environment.yml" output_dir="${READTHEDOCS_OUTPUT:-_readthedocs}" output_dir="${output_dir%/}" version="${READTHEDOCS_VERSION:-local}" canonical_url="${READTHEDOCS_CANONICAL_URL:-https://doxygen-awesome-css.readthedocs.io/}" rtd_doxyfile="${output_dir}/Doxyfile.readthedocs" rtd_header="${output_dir}/header.readthedocs.html" function setup_conda_env { echo "Creating conda environment '${conda_env_name}' from ${environment_file}" conda env create --quiet --name "${conda_env_name}" --file "${environment_file}" # activate the env in this shell so doxygen/dot below resolve to the conda versions # shellcheck disable=SC1091 source "$(conda info --base)/etc/profile.d/conda.sh" conda activate "${conda_env_name}" } mkdir -p "${output_dir}" setup_conda_env doxygen --version dot -V awk ' /^\$search$/ { print print "" print "" next } { print } ' doxygen-custom/header.html > "${rtd_header}" cp Doxyfile "${rtd_doxyfile}" cat >> "${rtd_doxyfile}" <