mirror of https://github.com/rancher/gitjob.git
36 lines
723 B
Bash
Executable File
36 lines
723 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
|
DIRTY="+dirty"
|
|
fi
|
|
|
|
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}
|
|
|
|
if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
|
|
VERSION=$GIT_TAG
|
|
else
|
|
# Make sure tags are available in the CI environment
|
|
readarray -t TAGS < <(git tag -l)
|
|
if [[ ${#TAGS[@]} == 0 ]]; then
|
|
git fetch -t
|
|
fi
|
|
VERSION="$(git describe --tags)${DIRTY}"
|
|
fi
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
ARCH=$(go env GOHOSTARCH)
|
|
fi
|
|
|
|
SUFFIX="-${ARCH}"
|
|
|
|
HELM_TAG=${TAG:-${VERSION}}
|
|
HELM_VERSION=${HELM_TAG/v/}
|
|
TAG=${TAG:-${VERSION}${SUFFIX}}
|
|
REPO=${REPO:-rancher}
|
|
|
|
if echo $TAG | grep -q dirty; then
|
|
TAG=dev
|
|
HELM_TAG=dev
|
|
HELM_VERSION=v0.0.0
|
|
fi
|