-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
41 lines (32 loc) · 1.16 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
#!/bin/sh
# Exit on error
set -e
# use DEBUG=echo ./release-all.sh to print all commands
export DEBUG=${DEBUG:-""}
export SERVER=${SERVER:-"hub.ncsa.illinois.edu"}
$DEBUG docker login ${SERVER}
# Find out what branch we are on
BRANCH=${BRANCH:-"$(git rev-parse --abbrev-ref HEAD)"}
PKG_VERSION=$(cat package.json | grep \"version\" | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,",]//g' | tr -d '[[:space:]]')
# Find out the version
if [ "$BRANCH" = "main" ]; then
echo "Detected version ${PKG_VERSION}"
VERSIONS="latest"
OLDVERSION=""
TMPVERSION=$PKG_VERSION
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSIONS="${VERSIONS} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
TAG=$VERSIONS
elif [ "${BRANCH}" = "develop" ]; then
TAG="develop"
else
# Get the issue number for tagging
TAG=$(echo $BRANCH | sed -e 's/^.*INCORE1-\([0-9]*\).*/INCORE-\1/' -e 's/^\(.\{15\}\).*/\1/' -e 's|/|-|g')
fi
for v in ${TAG}; do
${DEBUG} docker tag incore/frontend hub.ncsa.illinois.edu/incore/frontend:${v}
${DEBUG} docker push ${SERVER}/incore/frontend:${v}
done