-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
80 lines (69 loc) · 3.07 KB
/
action.yaml
File metadata and controls
80 lines (69 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: setup-helm-azure-tpl
description: Setup Helm azure-tpl plugin
inputs:
version:
description: Plugin version
type: string
runs:
using: "composite"
steps:
- name: "Install Helm azure-tpl plugin"
shell: bash
run: |
#!/bin/bash
set -e
if [[ -z "$AZURE_TPL_VERSION" || "$AZURE_TPL_VERSION" == "latest" ]]; then
AZURE_TPL_GIT_VERSION="main"
AZURE_TPL_RELEASE_VERSION="latest"
fi
echo "::group::detect helm version"
HELM_VERSION_TEXT=$(helm version --template='{{.Version}}')
echo "got Helm version \"${HELM_VERSION_TEXT}\""
HELM_VERSION=""
if [[ "$HELM_VERSION_TEXT" == "v3."* ]]; then
echo "detected Helm v3"
HELM_VERSION=3
elif [[ "$HELM_VERSION_TEXT" == "v4."* ]]; then
echo "detected Helm v4"
HELM_VERSION=4
else
echo "invalid Helm version found: ${HELM_VERSION_TEXT}"
exit 1
fi
echo "::endgroup::"
echo "::group::detect helm environment"
# add helm env vars
eval $(helm env)
echo "helm plugin path: ${HELM_PLUGINS}"
echo "::endgroup::"
case "$HELM_VERSION" in
3)
echo "::group::uninstall Helm v3 plugin"
helm plugin uninstall azure-tpl || true
helm plugin uninstall azure-tpl-cli || true
helm plugin uninstall azure-tpl-getter || true
echo "::endgroup::"
echo "::group::install Helm v3 plugin (version: $AZURE_TPL_GIT_VERSION)"
helm plugin install https://github.com/webdevops/helm-azure-tpl.git --version="$AZURE_TPL_GIT_VERSION"
echo "::endgroup::"
;;
4)
echo "::group::uninstall Helm v4 plugin"
helm plugin uninstall azure-tpl || true
helm plugin uninstall azure-tpl-cli || true
helm plugin uninstall azure-tpl-getter || true
echo "::endgroup::"
echo "::group::install Helm v4 plugin (version: $AZURE_TPL_RELEASE_VERSION)"
helm plugin install "https://github.com/webdevops/helm-azure-tpl/releases/${AZURE_TPL_RELEASE_VERSION}/download/azure-tpl-cli.tgz" --verify=false
helm plugin install "https://github.com/webdevops/helm-azure-tpl/releases/${AZURE_TPL_RELEASE_VERSION}/download/azure-tpl-getter.tgz" --verify=false
echo "::endgroup::"
;;
*)
echo "invalid Helm version found, only version 3 or 4 are supported: ${HELM_VERSION_TEXT}"
exit 1
esac
echo "succeeded"
exit 0
env:
AZURE_TPL_VERSION: ${{ inputs.version }}
$RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}