-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·44 lines (37 loc) · 1.15 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
#!/bin/sh
# Exit on error
set -e
# use DEBUG=echo ./release-all.sh to print all commands
export DEBUG=${DEBUG:-""}
# Find out what branch we are on
BRANCH=${BRANCH:-"$(git rev-parse --abbrev-ref HEAD)"}
# use SERVER=XYZ/ to push to a different server
SERVER=${SERVER:-""}
# find out the version
if [ "${BRANCH}" = "master" ]; then
VERSION=${VERSION:-""}
if [ "${VERSION}" = "" ]; then
TMPVERSION=$(cat pom.xml | grep "<version>.*</version>" | head -1 |awk -F'[><]' '{print $3}')
echo "Detected version ${TMPVERSION}"
VERSION="latest"
OLDVERSION=""
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSION="${VERSION} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
fi
elif [ "${BRANCH}" = "develop" ]; then
VERSION="develop"
else
exit 0
fi
# tag and push all images
for i in datawolf; do
for v in ${VERSION}; do
if [ "$v" != "latest" -o "$SERVER" != "" ]; then
${DEBUG} docker tag ncsa/${i}:latest ${SERVER}ncsa/${i}:${v}
fi
${DEBUG} docker push ${SERVER}ncsa/${i}:${v}
done
done