mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Drone: trigger on weekly release branches * Update the image-tag to include the branch name on non-tags * tools/image-tag: use bash This requires bash to be installed in the alpine/git image docker run --rm -it --entrypoint /bin/sh alpine/git /git # bash /bin/sh: bash: not found /git # apk --update --no-cache add bash fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz (1/2) Installing readline (8.1.0-r0) (2/2) Installing bash (5.1.0-r0) Executing bash-5.1.0-r0.post-install Executing busybox-1.32.1-r6.trigger OK: 27 MiB in 33 packages /git # ^C * Add CHANGELOG entry
22 lines
562 B
Bash
Executable File
22 lines
562 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
WIP=$(git diff --quiet || echo '-WIP')
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#/#-#g')
|
|
# When 7 chars are not enough to be unique, git automatically uses more.
|
|
# We are forcing to 7 here, as we are doing for grafana/grafana as well.
|
|
SHA=$(git rev-parse --short=7 HEAD | head -c7)
|
|
|
|
# If not a tag, use branch-hash else use tag
|
|
TAG=$((git describe --exact-match 2> /dev/null || echo "") | sed 's/v//g')
|
|
|
|
if [ -z "$TAG" ]
|
|
then
|
|
echo ${BRANCH}-${SHA}${WIP}
|
|
else
|
|
echo ${TAG}
|
|
fi
|