19 lines
606 B
Bash
19 lines
606 B
Bash
#!/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}
|
||
|
|
base=${version%%-[0-9]*}
|
||
|
|
app_version=$(sed -n 's/^appVersion:[[:space:]]*//p' Chart.yaml | tr -d '"')
|
||
|
|
test -n "$app_version" || { echo 'Chart.yaml appVersion is missing' >&2; exit 1; }
|
||
|
|
test "$base" = "$app_version" || {
|
||
|
|
echo "Git release $base does not match Chart.yaml appVersion $app_version" >&2
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
case "$version" in
|
||
|
|
*-0-g*) version=${version%%-0-g*} ;;
|
||
|
|
esac
|
||
|
|
printf '%s\n' "$version"
|