From d620ef50c47be88471c7d7ad88bc1435e54d995b Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 25 Jan 2023 23:59:30 -0600 Subject: [PATCH] :memo: Add chart icons to docs --- charts/bookstack/README.md | 2 ++ charts/borgmatic/README.md | 2 ++ charts/changedetection-io/README.md | 2 ++ charts/flame/README.md | 2 ++ charts/hammond/README.md | 2 ++ charts/headscale/README.md | 2 ++ charts/homer/README.md | 2 ++ charts/miniflux/README.md | 2 ++ charts/mnemonic-ninja/README.md | 2 ++ charts/monica/README.md | 2 ++ charts/nightscout/README.md | 2 ++ charts/pictshare/README.md | 2 ++ charts/portfolio/README.md | 2 ++ charts/relax-sounds/README.md | 2 ++ charts/rss-bridge/README.md | 2 ++ charts/rsshub/README.md | 2 ++ charts/smarter-device-manager/README.md | 2 ++ charts/tandoor/README.md | 2 ++ charts/vaultwarden/README.md | 2 ++ hack/gen-helm-docs.sh | 31 +++++++++++++++++-------- hack/templates/README.md.gotmpl | 1 + hack/templates/icon.gotmpl | 7 ++++++ 22 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 hack/templates/icon.gotmpl diff --git a/charts/bookstack/README.md b/charts/bookstack/README.md index 2377964e4..b197694bb 100644 --- a/charts/bookstack/README.md +++ b/charts/bookstack/README.md @@ -1,5 +1,7 @@ # bookstack +bookstack logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: version-v22.11.1](https://img.shields.io/badge/AppVersion-version--v22.11.1-informational?style=flat-square) diff --git a/charts/borgmatic/README.md b/charts/borgmatic/README.md index 3ca4c3840..467c11825 100644 --- a/charts/borgmatic/README.md +++ b/charts/borgmatic/README.md @@ -1,5 +1,7 @@ # borgmatic +borgmatic logo + ![Version: 0.5.3](https://img.shields.io/badge/Version-0.5.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.7.5](https://img.shields.io/badge/AppVersion-1.7.5-informational?style=flat-square) diff --git a/charts/changedetection-io/README.md b/charts/changedetection-io/README.md index e615d405a..818e6806f 100644 --- a/charts/changedetection-io/README.md +++ b/charts/changedetection-io/README.md @@ -1,5 +1,7 @@ # changedetection-io +changedetection-io logo + ![Version: 0.3.3](https://img.shields.io/badge/Version-0.3.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.40.1.1](https://img.shields.io/badge/AppVersion-0.40.1.1-informational?style=flat-square) diff --git a/charts/flame/README.md b/charts/flame/README.md index e41d6b6d1..479684f13 100644 --- a/charts/flame/README.md +++ b/charts/flame/README.md @@ -1,5 +1,7 @@ # flame +flame logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: multiarch2.3.0](https://img.shields.io/badge/AppVersion-multiarch2.3.0-informational?style=flat-square) diff --git a/charts/hammond/README.md b/charts/hammond/README.md index cf92477cf..f0a011487 100644 --- a/charts/hammond/README.md +++ b/charts/hammond/README.md @@ -1,5 +1,7 @@ # hammond +hammond logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) diff --git a/charts/headscale/README.md b/charts/headscale/README.md index e7e44f078..57c2e5971 100644 --- a/charts/headscale/README.md +++ b/charts/headscale/README.md @@ -1,5 +1,7 @@ # headscale +headscale logo + ![Version: 0.4.1](https://img.shields.io/badge/Version-0.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.18.0](https://img.shields.io/badge/AppVersion-0.18.0-informational?style=flat-square) diff --git a/charts/homer/README.md b/charts/homer/README.md index 26ff7dbb0..3b7a05296 100644 --- a/charts/homer/README.md +++ b/charts/homer/README.md @@ -1,5 +1,7 @@ # homer +homer logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v22.11.2](https://img.shields.io/badge/AppVersion-v22.11.2-informational?style=flat-square) diff --git a/charts/miniflux/README.md b/charts/miniflux/README.md index 11a688c26..af8d46578 100644 --- a/charts/miniflux/README.md +++ b/charts/miniflux/README.md @@ -1,5 +1,7 @@ # miniflux +miniflux logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.41](https://img.shields.io/badge/AppVersion-2.0.41-informational?style=flat-square) diff --git a/charts/mnemonic-ninja/README.md b/charts/mnemonic-ninja/README.md index 4dbbe3de5..7220238c8 100644 --- a/charts/mnemonic-ninja/README.md +++ b/charts/mnemonic-ninja/README.md @@ -1,5 +1,7 @@ # mnemonic-ninja +mnemonic-ninja logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) diff --git a/charts/monica/README.md b/charts/monica/README.md index 887c34543..b329485a5 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -1,5 +1,7 @@ # monica +monica logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.7.0-fpm-alpine](https://img.shields.io/badge/AppVersion-3.7.0--fpm--alpine-informational?style=flat-square) diff --git a/charts/nightscout/README.md b/charts/nightscout/README.md index 4be71df54..8810e3d41 100644 --- a/charts/nightscout/README.md +++ b/charts/nightscout/README.md @@ -1,5 +1,7 @@ # nightscout +nightscout logo + ![Version: 0.4.1](https://img.shields.io/badge/Version-0.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 14.2.6](https://img.shields.io/badge/AppVersion-14.2.6-informational?style=flat-square) diff --git a/charts/pictshare/README.md b/charts/pictshare/README.md index 53ca06b7e..7b5c2457c 100644 --- a/charts/pictshare/README.md +++ b/charts/pictshare/README.md @@ -1,5 +1,7 @@ # pictshare +pictshare logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 72394f17](https://img.shields.io/badge/AppVersion-72394f17-informational?style=flat-square) diff --git a/charts/portfolio/README.md b/charts/portfolio/README.md index 4c502f616..7d7dd27d2 100644 --- a/charts/portfolio/README.md +++ b/charts/portfolio/README.md @@ -1,5 +1,7 @@ # portfolio +portfolio logo + ![Version: 0.3.1](https://img.shields.io/badge/Version-0.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) diff --git a/charts/relax-sounds/README.md b/charts/relax-sounds/README.md index ec7a52d43..831b00f21 100644 --- a/charts/relax-sounds/README.md +++ b/charts/relax-sounds/README.md @@ -1,5 +1,7 @@ # relax-sounds +relax-sounds logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) diff --git a/charts/rss-bridge/README.md b/charts/rss-bridge/README.md index 38b16d8f3..076279a0a 100644 --- a/charts/rss-bridge/README.md +++ b/charts/rss-bridge/README.md @@ -1,5 +1,7 @@ # rss-bridge +rss-bridge logo + ![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) diff --git a/charts/rsshub/README.md b/charts/rsshub/README.md index 5d3585a4f..a9b17a393 100644 --- a/charts/rsshub/README.md +++ b/charts/rsshub/README.md @@ -1,5 +1,7 @@ # rsshub +rsshub logo + ![Version: 0.2.3](https://img.shields.io/badge/Version-0.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) diff --git a/charts/smarter-device-manager/README.md b/charts/smarter-device-manager/README.md index b1b78e93c..5c8d7e637 100644 --- a/charts/smarter-device-manager/README.md +++ b/charts/smarter-device-manager/README.md @@ -1,5 +1,7 @@ # smarter-device-manager +smarter-device-manager logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.20.11](https://img.shields.io/badge/AppVersion-v1.20.11-informational?style=flat-square) diff --git a/charts/tandoor/README.md b/charts/tandoor/README.md index 85fbd0c6a..05d33c269 100644 --- a/charts/tandoor/README.md +++ b/charts/tandoor/README.md @@ -1,5 +1,7 @@ # tandoor +tandoor logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4.5](https://img.shields.io/badge/AppVersion-1.4.5-informational?style=flat-square) diff --git a/charts/vaultwarden/README.md b/charts/vaultwarden/README.md index c5852771c..b25b90f98 100644 --- a/charts/vaultwarden/README.md +++ b/charts/vaultwarden/README.md @@ -1,5 +1,7 @@ # vaultwarden +vaultwarden logo + ![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.27.0-alpine](https://img.shields.io/badge/AppVersion-1.27.0--alpine-informational?style=flat-square) diff --git a/hack/gen-helm-docs.sh b/hack/gen-helm-docs.sh index 1e44ec242..dba883a02 100755 --- a/hack/gen-helm-docs.sh +++ b/hack/gen-helm-docs.sh @@ -10,13 +10,20 @@ command -v helm-docs >/dev/null 2>&1 || { exit 1 } +# require yq +command -v yq >/dev/null 2>&1 || { + echo >&2 'yq (https://github.com/mikefarah/yq) is not installed. Aborting.' + exit 1 +} + # Absolute path of repository repository="$(git rev-parse --show-toplevel)" charts_folder="$repository/charts" # Templates to copy into each chart directory -readme_template="$repository/hack/templates/README.md.gotmpl" -readme_config_template="$repository/hack/templates/README_CONFIG.md.gotmpl" +template_dir="$repository/hack/templates" +readme_config_template="$template_dir/README_CONFIG.md.gotmpl" +icon_template=$(<"$template_dir/icon.gotmpl") # Gather all charts using the common library, excluding common-test charts="$(find "$charts_folder" -name Chart.yaml)" @@ -33,15 +40,19 @@ else root="$charts_folder" fi -for chart in $charts; do +for chart in $charts; do ( chart_directory="$(dirname "$chart")" - echo "-] Copying templates to $chart_directory" + icon="$(yq eval '.icon // ""' "$chart" 2>/dev/null)" + # Copy CONFIG template to each Chart directory, do not overwrite if exists cp -n "$readme_config_template" "$chart_directory" || true -done -# Run helm-docs for charts using the common library and the common library itself -helm-docs \ - --template-files="$readme_template" \ - --template-files="$(basename "$readme_config_template")" \ - --chart-search-root="$root" + # Run helm-docs for charts + helm-docs \ + --log-level=warning \ + --template-files="$template_dir/README.md.gotmpl" \ + --template-files=<(echo "${icon_template/\$ICON/$icon}") \ + --template-files="$(basename "$readme_config_template")" \ + --chart-search-root="$root" \ + --chart-to-generate="$chart_directory" +) done diff --git a/hack/templates/README.md.gotmpl b/hack/templates/README.md.gotmpl index 4ca754406..ce69bb15d 100644 --- a/hack/templates/README.md.gotmpl +++ b/hack/templates/README.md.gotmpl @@ -98,6 +98,7 @@ helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} - {{- end -}} {{ template "chart.header" . }} +{{ template "custom.chart.icon" . -}} {{ template "chart.versionBadge" . }} {{ template "chart.typeBadge" . }} diff --git a/hack/templates/icon.gotmpl b/hack/templates/icon.gotmpl new file mode 100644 index 000000000..9dee27b91 --- /dev/null +++ b/hack/templates/icon.gotmpl @@ -0,0 +1,7 @@ +{{- define "custom.chart.icon" -}} +{{- $icon := "$ICON" -}} +{{- if $icon -}} + {{ template + +{{ end -}} +{{- end -}}