This commit is contained in:
@ -1,9 +1,8 @@
|
||||
FROM alpine/helm:3.11.1 as helm
|
||||
FROM alpine/helm:3.11.3 as helm
|
||||
|
||||
RUN set -ex \
|
||||
&& apk upgrade \
|
||||
&& apk add --no-cache bash \
|
||||
&& helm plugin install https://github.com/chartmuseum/helm-push \
|
||||
\
|
||||
&& wget -qO- https://github.com/mikefarah/yq/releases/download/v4.30.8/yq_linux_amd64 -O /usr/local/bin/yq \
|
||||
&& chmod +x /usr/local/bin/yq \
|
||||
|
22
script.sh
22
script.sh
@ -2,31 +2,19 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Add current repo
|
||||
export HELM_REPO_USERNAME="$PLUGIN_USERNAME"
|
||||
export HELM_REPO_PASSWORD="$PLUGIN_PASSWORD"
|
||||
REGISTRY=${PLUGIN_REGISTRY:-"https://harbor.grachevko.ru/chartrepo"}
|
||||
REPO=${PLUGIN_NAME:-${DRONE_REPO_OWNER}}
|
||||
repo="$REGISTRY"/"$REPO"
|
||||
|
||||
helm repo add "$REPO" "$repo"
|
||||
REGISTRY=${PLUGIN_REGISTRY:-"oci://harbor.grachevko.ru/"}
|
||||
repo="$REGISTRY/$DRONE_REPO_OWNER/chart/$PLUGIN_NAME"
|
||||
|
||||
# Dependencies
|
||||
eval "$(yq '.dependencies' Chart.yaml | yq 'unique_by(.repository)' - | yq '.[] | "helm repo add " + .name + " " + .repository' -)"
|
||||
helm dependency build
|
||||
helm dependency update
|
||||
|
||||
# Lint
|
||||
helm lint --strict .
|
||||
|
||||
# Bump version
|
||||
previousVersion=$(helm search repo "$REPO" -o yaml | yq '.[0].version')
|
||||
bump="patch"
|
||||
case "${DRONE_COMMIT_MESSAGE:0:8}" in
|
||||
Major* ) bump="major";;
|
||||
feat* ) bump="minor";;
|
||||
esac
|
||||
new_version=$(semver bump "$bump" "$previousVersion")
|
||||
yq -i '.version = "'"$new_version"'"' Chart.yaml
|
||||
helm package --version "${PLUGIN_TAG}"
|
||||
|
||||
# Push new version
|
||||
helm cm-push . "$repo"
|
||||
helm push ./*.tgz "$repo"
|
||||
|
Reference in New Issue
Block a user