TrueChartsClone/tools/gen-helm-docs.sh

40 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -eu
# Generate helm-docs for Helm charts
# Usage ./gen-helm-docs.sh [chart]
# require helm-docs
command -v helm-docs >/dev/null 2>&1 || {
echo >&2 "helm-docs is not installed. Aborting."
exit 1
}
# Absolute path of repository
repository=$(git rev-parse --show-toplevel)
# Templates to copy into each chart directory
2021-05-30 11:14:37 +00:00
readme_template="${repository}/tools/templates/docs/README.md.gotmpl"
config_template="${repository}/tools/templates/docs/CONFIG.md.gotmpl"
root="${repository}"
2021-05-09 11:31:49 +00:00
for train in stable incubator develop non-free deprecated; do
2021-06-11 15:24:57 +00:00
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "-] Copying templates to ${repository}/${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="README.md" \
2021-05-30 11:14:37 +00:00
--template-files="${repository}/tools/templates/docs/README.md.gotmpl" \
--chart-search-root="${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="CONFIG.md" \
2021-05-30 11:14:37 +00:00
--template-files="${repository}/tools/templates/docs/CONFIG.md.gotmpl" \
--chart-search-root="${chart}"
fi
done
done