hub/script/version

14 строки
351 B
Bash
Executable File

#!/usr/bin/env bash
# Displays hub's release version
set -e
version="$(git describe --tags HEAD 2>/dev/null || true)"
if [ -z "$version" ]; then
version="$(grep Version version/version.go | head -1 | cut -d '"' -f2)"
sha="$(git rev-parse --short HEAD 2>/dev/null || true)"
[ -z "$sha" ] || version="${version}-g${sha}"
fi
echo "${version#v}"