From 5025bdaf37d23da49e260497c43cabb1cd77122a Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Thu, 8 Dec 2022 13:14:31 +0100 Subject: [PATCH] Add Helm chart workflow that checks for updated documentation Signed-off-by: Marco Franssen --- .github/scripts/helm-docs.sh | 46 ++++++++++++++++++++++++++++ .github/workflows/helm-chart-ci.yaml | 23 ++++++++++++++ .gitignore | 1 + 3 files changed, 70 insertions(+) create mode 100755 .github/scripts/helm-docs.sh create mode 100644 .github/workflows/helm-chart-ci.yaml create mode 100644 .gitignore diff --git a/.github/scripts/helm-docs.sh b/.github/scripts/helm-docs.sh new file mode 100755 index 0000000..d77d15c --- /dev/null +++ b/.github/scripts/helm-docs.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPTPATH=$(dirname "$0") +HELM_DOCS_VERSION="1.11.0" + +case "$(uname -s)" in + Linux*) + machine=Linux + shasum=sha256sum + exe=helm-docs + ;; + Darwin*) + machine=Darwin + shasum=shasum + exe=helm-docs + ;; + MINGW64*) + machine=Windows + shasum=sha256sum + exe=helm-docs.exe + ;; +esac + +function install_helm_docs { + 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 ${exe} + mv ${exe} "$SCRIPTPATH/bin/" + rm helm-docs_"${HELM_DOCS_VERSION}"_${machine}_x86_64.tar.gz +} + +if [ ! -f "$SCRIPTPATH/bin/${exe}" ] ; then + install_helm_docs +elif [[ ! "$("$SCRIPTPATH/bin/${exe}" --version)" =~ .*"$HELM_DOCS_VERSION".* ]] ; then + install_helm_docs +else + echo "Using '$("$SCRIPTPATH/bin/${exe}" --version)'" +fi + +# validate docs +"$SCRIPTPATH/bin/${exe}" +git diff --exit-code diff --git a/.github/workflows/helm-chart-ci.yaml b/.github/workflows/helm-chart-ci.yaml new file mode 100644 index 0000000..cecd1ce --- /dev/null +++ b/.github/workflows/helm-chart-ci.yaml @@ -0,0 +1,23 @@ +name: Helm Chart CI + +on: + pull_request: + paths: + - 'charts/**' + - '.github/workflows/helm-chart-ci.yml' + - '.github/scripts/*.sh' + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + check-docs: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3.1.0 + + - name: Verify Docs updated + run: .github/scripts/helm-docs.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bcaef3e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.github/scripts/bin