20 lines
499 B
Bash
Executable File
20 lines
499 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# ensure packages are installed
|
|
if ! command -v git &> /dev/null; then
|
|
echo "Error: git is not installed. Please install git and try again."
|
|
exit 1
|
|
fi
|
|
|
|
# This script returns the new version string.
|
|
# It's built using the last semver git tag.
|
|
# For this
|
|
# - we use git describe (1).
|
|
# - remove the prefix 'v' (2)
|
|
# - remove the prefix 'g' from the current hash
|
|
|
|
get_version_string() {
|
|
git describe --tags --always --abbrev=10 | sed 's/^v//' | sed 's/-g/-/'
|
|
}
|
|
|
|
echo $(get_version_string) |