All checks were successful
continuous-integration/drone/push Build is passing
33 lines
812 B
Bash
Executable File
33 lines
812 B
Bash
Executable File
#!/bin/sh
|
|
|
|
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"
|
|
|
|
# Dependencies
|
|
eval "$(yq -o=j -I=0 '.dependencies[]' Chart.yaml | yq '"helm repo add " + .name + " " + .repository' -)"
|
|
helm dependency build
|
|
|
|
# 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
|
|
|
|
# Push new version
|
|
helm cm-push . "$repo"
|