forked from camunda/docker-camunda-bpm-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·56 lines (46 loc) · 1.41 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash -eux
EE=${EE:-false}
VERSION=${VERSION:-$(grep VERSION= Dockerfile | head -n1 | cut -d = -f 2)}
DISTRO=${DISTRO:-$(grep DISTRO= Dockerfile | cut -d = -f 2)}
SNAPSHOT=${SNAPSHOT:-$(grep SNAPSHOT= Dockerfile | cut -d = -f 2)}
IMAGE=camunda/camunda-bpm-platform
function tag_and_push {
local tag=${1}
docker tag ${IMAGE}:${DISTRO} ${IMAGE}:${tag}
docker push ${IMAGE}:${tag}
}
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
echo "Not pushing pull request to docker hub"
exit 0
fi
if ! [[ "${TRAVIS_BRANCH}" =~ master|7.[0-9]+|next ]]; then
echo "Not pushing development branch to docker hub"
exit 0
fi
if [ "${EE}" = "true" ]; then
echo "Not pushing EE image to docker hub"
exit 0
fi
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"
if [ "${SNAPSHOT}" = "true" ]; then
tag_and_push "${DISTRO}-${VERSION}-SNAPSHOT"
tag_and_push "${DISTRO}-SNAPSHOT"
if [ "${DISTRO}" = "tomcat" ]; then
tag_and_push "${VERSION}-SNAPSHOT"
tag_and_push "SNAPSHOT"
fi
else
tag_and_push "${DISTRO}-${VERSION}"
if [ "${DISTRO}" = "tomcat" ]; then
tag_and_push "${VERSION}"
fi
fi
git fetch origin master
if [ $(git rev-parse HEAD) = $(git rev-parse FETCH_HEAD) ]; then
# tagging image as latest
tag_and_push "${DISTRO}-latest"
tag_and_push "${DISTRO}"
if [ "${DISTRO}" = "tomcat" ]; then
tag_and_push "latest"
fi
fi