commit 88ebd7fc1b2b4d03e90dd5f6ecd15d852c4b3c05 Author: Konstantin Grachev Date: Wed Feb 15 00:01:39 2023 +0300 init diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6b8710a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..585ebd7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine/helm:3.10.2 as helm + +RUN set -ex \ + && 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 \ + \ + && wget -qO- https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver -O /usr/local/bin/semver \ + && chmod +x /usr/local/bin/semver + +ADD script.sh /bin/ + +ENTRYPOINT /bin/script.sh diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..a4e6b6d --- /dev/null +++ b/script.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +helm lint . + +export HELM_REPO_USERNAME="$PLUGIN_USERNAME" +export HELM_REPO_PASSWORD="$PLUGIN_PASSWORD" + +repo="$PLUGIN_REGISTRY"/"$PLUGIN_NAME" + +helm repo add "$PLUGIN_NAME" "$repo" + +previousVersion=$(helm search repo "$PLUGIN_NAME" -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 + +# TODO add dependencies dynamically +helm repo add bitnami https://charts.bitnami.com/bitnami + +helm dependency build +helm cm-push . "$repo"