forked from hypertrace/github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·26 lines (23 loc) · 917 Bytes
/
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
#!/bin/sh -l
if [ $1 == "validate" ]; then
echo "validating helm charts"
helm dependency update $2
helm lint --strict $2 $3
helm template $2 $3
elif [ $1 == "publish" ]; then
echo $GITHUB_REF
CHART_VERSION=$(echo ${GITHUB_REF} | cut -d/ -f 3)
if [ -z "$CHART_VERSION" ]; then
CHART_VERSION=$(git describe --abbrev=0 --tags)
fi
echo $CHART_VERSION
CHART_NAME=$(awk '/^name:/ {print $2}' $2/Chart.yaml)
INPUT_REPOSITORY=$3
INPUT_CREDENTIALS=$4
export GOOGLE_APPLICATION_CREDENTIALS=${HOME}/helm-gcs-key.json
echo ${INPUT_CREDENTIALS:-$HELM_GCS_CREDENTIALS} > ${GOOGLE_APPLICATION_CREDENTIALS}
helm dependency update $2
helm repo add helm-gcs ${INPUT_REPOSITORY:-$HELM_GCS_REPOSITORY}
helm package --version ${CHART_VERSION} --app-version ${CHART_VERSION} $2
helm gcs push ${CHART_NAME}-${CHART_VERSION}.tgz helm-gcs --public --retry
fi