1
0
mirror of https://github.com/rancher/cli.git synced 2026-02-05 18:48:50 +01:00
Files
cli/scripts/version
2018-09-11 11:15:13 -07:00

15 lines
308 B
Bash
Executable File

#!/bin/bash
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DIRTY="-dirty"
fi
COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}
if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
VERSION=$GIT_TAG
else
VERSION="${COMMIT}${DIRTY}"
fi