mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
21 lines
502 B
Bash
Executable File
21 lines
502 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# pull the current git commit hash
|
|
VERSION=$(git rev-parse HEAD)
|
|
|
|
# check if the current commit has a matching tag,
|
|
# and prepend the matching tag to the version, if available.
|
|
TAG=$(git describe --exact-match --abbrev=0 --tags ${VERSION} 2> /dev/null || true)
|
|
if [ -z "$TAG" ]; then
|
|
VERSION=$TAG_$VERSION
|
|
fi
|
|
|
|
# check for changed files (not untracked files)
|
|
if [ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ]; then
|
|
VERSION="${VERSION}_dirty"
|
|
fi
|
|
|
|
echo "$VERSION"
|