18 lines
372 B
Bash
18 lines
372 B
Bash
#!/bin/sh
|
|
|
|
VERSION=$(git describe --always --tags --match "v[0-9]*" HEAD 2>/dev/null)
|
|
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
VERSION="${VERSION}-dirty"
|
|
fi
|
|
|
|
if [ -f "${1}" ]; then
|
|
OLD=$(cat ${1} | sed 's/VERSION = //')
|
|
else
|
|
OLD=unset
|
|
fi
|
|
|
|
if [ "${VERSION}" != "${OLD}" ]; then
|
|
#echo >&2 "VERSION = ${VERSION}"
|
|
echo "VERSION = ${VERSION}" > ${1}
|
|
fi
|