11#! /usr/bin/env bash
22
3+ # Copyright 2020 Stefan Prodan. All rights reserved.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
317set -o errexit
418set -o pipefail
519
@@ -19,7 +33,7 @@ REPO_URL=""
1933
2034main () {
2135 if [[ -z " $HELM_VERSION " ]]; then
22- HELM_VERSION=" 3.2.1 "
36+ HELM_VERSION=" 3.3.0 "
2337 fi
2438
2539 if [[ -z " $CHARTS_DIR " ]]; then
@@ -114,7 +128,14 @@ upload() {
114128
115129 mkdir -p ${TARGET_DIR}
116130 mv -f ${CHARTS_TMP_DIR} /* .tgz ${TARGET_DIR}
117- helm repo index ${TARGET_DIR} --url ${CHARTS_URL}
131+
132+ if [[ -f " ${TARGET_DIR} /index.yaml" ]]; then
133+ echo " Found index, merging changes"
134+ helm repo index ${TARGET_DIR} --url ${CHARTS_URL} --merge " ${TARGET_DIR} /index.yaml"
135+ else
136+ echo " No index found, generating a new one"
137+ helm repo index ${TARGET_DIR} --url ${CHARTS_URL}
138+ fi
118139
119140 git add ${TARGET_DIR}
120141 git commit -m " Publish $charts "
0 commit comments