summaryrefslogtreecommitdiff
path: root/client/hooks/post_push
blob: 1b1e0ad902d0b4abfc01f26c63cd3d3347b1e61d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

add_tag() {
    echo "Also tagging image as ${DOCKER_REPO}:${1}"
    docker tag $IMAGE_NAME $DOCKER_REPO:$1
    docker push $DOCKER_REPO:$1
}

CLOSEST_VER=$(git describe --tags --abbrev=0)
CLOSEST_MAJOR_VER=$(echo ${CLOSEST_VER} | cut -d'.' -f1)
CLOSEST_MINOR_VER=$(echo ${CLOSEST_VER} | cut -d'.' -f2)

add_tag "${CLOSEST_MAJOR_VER}-edge"
add_tag "${CLOSEST_MAJOR_VER}.${CLOSEST_MINOR_VER}-edge"

if git describe --exact-match --abbrev=0 2> /dev/null; then
    add_tag "${CLOSEST_MAJOR_VER}"
    add_tag "${CLOSEST_MAJOR_VER}.${CLOSEST_MINOR_VER}"
fi