subsurface/scripts/add-version-to-appdata.sh
Dirk Hohndel f252af1dd1 prevent the 'latest' tag from messing with our version
We need to use git describe in a way that only refers to vX.Y.Z style tags.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 04:00:32 -08:00

13 lines
629 B
Bash
Executable file

#!/bin/bash
#
# work either when building from git or when building from our hand
# crafted tar balls for OBS
# this will, however, fail for plain tar balls create via git archive
SCRIPT_DIR="$( cd "${BASH_SOURCE%/*}" ; pwd )"
VERSION=$(git describe --match "v[0-9]*" --abbrev=12) || VERSION=$(cat "$SCRIPT_DIR"/../.gitversion)
DATE=$(git log -1 --format="%ct" | xargs -I{} date -d @{} +%Y-%m-%d)
if [ "$DATE" = "" ] ; then
DATE=$(cat "$SCRIPT_DIR"/../.gitdate)
fi
sed -e "s|<release version=\"\" date=\"\" />|<release version=\"$VERSION\" date=\"$DATE\" />|" appdata/subsurface.appdata.xml.in > appdata/subsurface.appdata.xml