Skip to content

Commit

Permalink
Check for helm-docs are updated
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Franssen <[email protected]>
  • Loading branch information
marcofranssen committed Jan 2, 2023
1 parent 9cc2089 commit f4ce71e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/helm-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -euo pipefail

SCRIPTPATH=$(dirname "$0")
HELM_DOCS_VERSION="1.11.0"

function install_helm_docs {
case "$(uname -s)" in
Linux*)
machine=Linux
shasum=sha256sum
;;
Darwin*)
machine=Darwin
shasum=shasum
;;
esac

curl -LO https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz
curl -L --output /tmp/checksums_helm-docs.txt https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/checksums.txt
grep helm-docs_${HELM_DOCS_VERSION}_${machine}_x86_64.tar.gz /tmp/checksums_helm-docs.txt | $shasum -c -
mkdir -p "$SCRIPTPATH/bin"
tar -xf helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz helm-docs
mv helm-docs "$SCRIPTPATH/bin/"
rm helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz
}

if [ ! -f "$SCRIPTPATH/bin/helm-docs" ] ; then
install_helm_docs
elif [[ ! "$("$SCRIPTPATH/bin/helm-docs" --version)" =~ .*"$HELM_DOCS_VERSION".* ]] ; then
install_helm_docs
else
echo "Using '$("$SCRIPTPATH/bin/helm-docs" --version)'"
fi

# validate docs
"$SCRIPTPATH/bin/helm-docs" -t "$SCRIPTPATH/README.md.tmpl" -g $1
git diff --exit-code
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- ".github/workflows/test.yml"
- ".github/helm-docs.sh"
- "charts/**"

jobs:
Expand Down Expand Up @@ -56,6 +57,10 @@ jobs:
git diff --exit-code
working-directory: ${{ matrix.chart }}

- name: Check docs updated
run: ../../.github/helm-docs.sh .
working-directory: ${{ matrix.chart }}

test:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ charts/*/Chart.lock

# Vim swap files
*.swp

.github/bin
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,11 @@ Any changes to Chart.yaml or values.yaml require an update of the README.md. Thi
helm-docs -g charts/«chart-name»
```

or

```shell
.github/helm-docs.sh charts/«chart-name»
```

[crane]: https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md "Crane is a tool for managing container images"
[helm-docs]: https://github.com/norwoodj/helm-docs "The helm-docs tool auto-generates documentation from helm charts into markdown files."

0 comments on commit f4ce71e

Please sign in to comment.