Files

17 lines
620 B
Bash
Raw Permalink Normal View History

2026-10-18 17:27:23 +02:00
#!/bin/sh
set -eu
description=$(git describe --tags --long --match 'v[0-9]*' --dirty)
case "$description" in
*-dirty) echo "refusing to package a dirty tree" >&2; exit 1 ;;
esac
version=${description#v}
case "$version" in
*-0-g*) version=${version%%-0-g*} ;;
esac
2026-10-19 21:02:13 +02:00
# Upstream uses four numeric components (for example v1.0.39.0), whereas
# Helm chart versions must be SemVer. Keep the upstream Git tag verbatim and
# encode its fourth component as a SemVer prerelease identifier.
version=$(printf '%s\n' "$version" | sed -E 's/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)(-.*)?$/\1.\2.\3-\4\5/')
2026-10-18 17:27:23 +02:00
printf '%s\n' "$version"