Skip to content

Commit d92459c

Browse files
committed
Check for helm-docs are updated
Signed-off-by: Marco Franssen <[email protected]>
1 parent d738c39 commit d92459c

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.github/helm-docs.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPTPATH=$(dirname "$0")
6+
HELM_DOCS_VERSION="1.11.0"
7+
8+
function install_helm_docs {
9+
case "$(uname -s)" in
10+
Linux*)
11+
machine=Linux
12+
shasum=sha256sum
13+
;;
14+
Darwin*)
15+
machine=Darwin
16+
shasum=shasum
17+
;;
18+
esac
19+
20+
curl -LO https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz
21+
curl -L --output /tmp/checksums_helm-docs.txt https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/checksums.txt
22+
grep helm-docs_${HELM_DOCS_VERSION}_${machine}_x86_64.tar.gz /tmp/checksums_helm-docs.txt | $shasum -c -
23+
mkdir -p "$SCRIPTPATH/bin"
24+
tar -xf helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz helm-docs
25+
mv helm-docs "$SCRIPTPATH/bin/"
26+
rm helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz
27+
}
28+
29+
if [ ! -f "$SCRIPTPATH/bin/helm-docs" ] ; then
30+
install_helm_docs
31+
elif [[ ! "$("$SCRIPTPATH/bin/helm-docs" --version)" =~ .*"$HELM_DOCS_VERSION".* ]] ; then
32+
install_helm_docs
33+
else
34+
echo "Using '$("$SCRIPTPATH/bin/helm-docs" --version)'"
35+
fi
36+
37+
# validate docs
38+
"$SCRIPTPATH/bin/helm-docs" -t "$SCRIPTPATH/README.md.tmpl" -g $1
39+
git diff --exit-code

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- ".github/workflows/test.yml"
7+
- ".github/helm-docs.sh"
78
- "charts/**"
89

910
jobs:
@@ -46,6 +47,10 @@ jobs:
4647
git diff --exit-code
4748
working-directory: ${{ matrix.chart }}
4849

50+
- name: Check docs updated
51+
run: .github/helm-docs.sh .
52+
working-directory: ${{ matrix.chart }}
53+
4954
test:
5055
runs-on: ubuntu-latest
5156
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ charts/*/Chart.lock
33

44
# Vim swap files
55
*.swp
6+
7+
.github/bin

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,11 @@ Any changes to Chart.yaml or values.yaml require an update of the README.md. Thi
5757
helm-docs -g charts/«chart-name»
5858
```
5959

60+
or
61+
62+
```shell
63+
.github/helm-docs.sh charts/«chart-name»
64+
```
65+
6066
[crane]: https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md "Crane is a tool for managing container images"
6167
[helm-docs]: https://github.com/norwoodj/helm-docs "The helm-docs tool auto-generates documentation from helm charts into markdown files."

0 commit comments

Comments
 (0)