-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathpublish-app.sh
executable file
·66 lines (66 loc) · 1.89 KB
/
publish-app.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
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
(return 0 2>/dev/null) && sourced=1 || sourced=0
function check_env() {
eval ev='$'$1
if [ "$ev" == "" ]; then
echo "$1 not defined"
if (( sourced != 0 )); then
return 1
else
exit 1
fi
fi
}
if [ "$2" == "" ]; then
echo "Argument: <project-folder> <application-folder> required"
if((sourced > 0)); then
exit 0
else
exit 1
fi
fi
PROJECT_FOLDER=$(realpath "$1")
APP_FOLDER=$2
pushd "$PROJECT_FOLDER" > /dev/null
if [ "$VERSION" == "" ]; then
VERSION=$($SCDIR/mvn-get-version.sh)
fi
echo "Project Version:$VERSION"
if [[ "$VERSION" != "3."* ]]; then
JDKS="17 21"
if [ "$DEFAULT_JDK" == "" ];then
DEFAULT_JDK="17"
fi
else
if [ "$DEFAULT_JDK" == "" ];then
DEFAULT_JDK="11"
fi
JDKS="8 11 17"
fi
pushd "$APP_FOLDER" > /dev/null
pushd apps > /dev/null
echo "Pushing:$APP_FOLDER/apps"
APPS=$(find * -maxdepth 0 -type d)
for app in $APPS; do
set -e
docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$VERSION"
docker push "springcloudstream/$app:$VERSION"
echo "Pushed:springcloudstream/$app:$VERSION"
if [ "$BRANCH" != "" ]; then
docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$BRANCH"
echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$BRANCH"
docker push "springcloudstream/$app:$BRANCH"
fi
docker push "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK"
echo "Pushed:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK"
for v in $JDKS; do
docker push "springcloudstream/$app:$VERSION-jdk$v"
echo "Pushed:springcloudstream/$app:$VERSION-jdk$v"
done
set +e
done
popd > /dev/null
popd > /dev/null
popd > /dev/null