diff --git a/.github/actions/setup-helm/action.yml b/.github/actions/setup-helm/action.yml new file mode 100644 index 000000000..f60cbc1b4 --- /dev/null +++ b/.github/actions/setup-helm/action.yml @@ -0,0 +1,22 @@ +name: "Setup Helm" +description: "Install the helm CLI" +inputs: + helm-version: + description: The helm version to install + default: "3.8.1" + required: false + linux-bin-path: + description: Where to put the helm binary on linux runners + required: false + win-bin-path: + description: Where to put the helm binary on windows runners + required: false +runs: + using: "composite" + steps: + - name: Install helm cli + shell: bash + env: + LIN_PATH: ${{ inputs.linux-bin-path }} + WIN_PATH: ${{ inputs.win-bin-path }} + run: ${{ github.action_path }}/setup-helm.sh ${{ inputs.helm-version }} diff --git a/.github/actions/setup-helm/setup-helm.sh b/.github/actions/setup-helm/setup-helm.sh new file mode 100755 index 000000000..75d9733b6 --- /dev/null +++ b/.github/actions/setup-helm/setup-helm.sh @@ -0,0 +1,15 @@ +#!/bin/bash -e +HELM_VERSION=$1 +WIN_PATH=${WIN_PATH:-$HOME/bin/} +LIN_PATH=${LIN_PATH:-/usr/local/bin/} +if [ "$RUNNER_OS" == "Windows" ]; then + curl -fsSLo helm.zip https://get.helm.sh/helm-v${HELM_VERSION}-windows-amd64.zip + unzip -o helm.zip windows-amd64/helm.exe && rm helm.zip && mv windows-amd64/helm.exe "${WIN_PATH}" && rmdir windows-amd64 +elif [ "$RUNNER_OS" == "Linux" ]; then + curl -fsSL https://get.helm.sh/helm-v${HELM_VERSION}-$(uname | tr '[:upper:]' '[:lower:]')-amd64.tar.gz | tar xz --strip=1 -C "${LIN_PATH}" $(uname | tr '[:upper:]' '[:lower:]')-amd64/helm +else + echo "$RUNNER_OS not supported" + exit 1 +fi + +echo helm $(helm version --client --short) has been installed diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8df65c8fc..ffdf6c963 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - uses: ./.github/actions/setup-helm - uses: ./.github/actions/setup-helm-docs - uses: ./.github/actions/setup-jx-release-version - uses: ./.github/actions/setup-rancher-cli diff --git a/README.md b/README.md index 89941828e..a85ac9ecf 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,19 @@ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) Shared [Travis CI](https://travis-ci.com/) and [pre-commit](https://pre-commit.com/) configuration files plus misc tools. + +## GitHub Actions + +### setup-helm + +If you need the helm cli available in the runner path: + +```yml +jobs: + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm@master +```