-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
49 lines (38 loc) · 1.3 KB
/
entrypoint.sh
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
#!/bin/bash
set -ex
export INPUT_CHARTS_FOLDER=${INPUT_CHARTS_FOLDER:-.}
if [ -z "${INPUT_CHART_NAME}" ]; then
echo "chart_name is not set"
exit 1
fi
if [ -z "${INPUT_REGISTRY_HOST}" ]; then
echo "registry_host is not set"
exit 1
fi
if [ -z "${INPUT_REPOSITORY_PATH}" ]; then
echo "repository_path is not set"
exit 1
fi
if [ -z "${INPUT_REPOSITORY_USER}" ]; then
echo "repository_user is not set"
exit 1
fi
if [ -z "${INPUT_REPOSITORY_PASSWORD}" ]; then
echo "repository_password is not set"
exit 1
fi
if [ -z "${INPUT_CHART_VERSION}" ]; then
echo "chart_version is not set"
exit 1
fi
if [ -z "${INPUT_APP_VERSION}" ]; then
echo "app_version is not set"
exit 1
fi
INPUT_CHART_VERSION=$(echo "${INPUT_CHART_VERSION}" | sed -e 's|refs/tags||' | sed -e 's/^v//')
INPUT_APP_VERSION=$(echo "${INPUT_APP_VERSION}" | sed -e 's|refs/tags||' | sed -e 's/^v//' | sed -e 's/+.*//')
cd "${INPUT_CHARTS_FOLDER}"
helm inspect chart "${INPUT_CHART_NAME}"
helm package --app-version "${INPUT_APP_VERSION}" --version "${INPUT_CHART_VERSION}" "${INPUT_CHART_NAME}"
echo "${INPUT_REPOSITORY_PASSWORD}" | helm registry login -u "${INPUT_REPOSITORY_USER}" --password-stdin "${INPUT_REGISTRY_HOST}"
helm push "${INPUT_CHART_NAME}-${INPUT_CHART_VERSION}.tgz" "oci://${INPUT_REGISTRY_HOST}/${INPUT_REPOSITORY_PATH}"