Archived
18 lines
386 B
Bash
Executable File
18 lines
386 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "usage: $0 CHART" >&2
|
|
exit 2
|
|
fi
|
|
chart=$1
|
|
description=$(git describe --tags --long --match "${chart}-v[0-9]*" --dirty)
|
|
case "$description" in
|
|
*-dirty) echo "refusing to package a dirty tree" >&2; exit 1 ;;
|
|
esac
|
|
version=${description#${chart}-v}
|
|
case "$version" in
|
|
*-0-g*) version=${version%%-0-g*} ;;
|
|
esac
|
|
printf '%s\n' "$version"
|