This commit is contained in:
2023-02-15 00:01:39 +03:00
commit 88ebd7fc1b
3 changed files with 44 additions and 0 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git

15
Dockerfile Normal file
View File

@ -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

28
script.sh Executable file
View File

@ -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"