-
Notifications
You must be signed in to change notification settings - Fork 41
/
publish.sh
executable file
·41 lines (33 loc) · 1.26 KB
/
publish.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
#!/bin/bash
echo "Starting deployment"
# Get current version
# Here we use a "short" version notation, i.e. {major}.{minor}.{patch}.${build}
# Commint SHA is not included in the artifacts naming. It is shown in the app only (e.g. in the GUI)
NGB_VERSION=$(./gradlew :printVersion -PbuildNumber=$APPVEYOR_BUILD_NUMBER | grep "Project version is " | sed 's/^.*is //')
echo "Current version is ${NGB_VERSION}"
cd dist
echo "Creating ${NGB_VERSION} distribution"
mkdir -p ${NGB_VERSION}
for file in *
do
[[ -d $file ]] && continue
ext="${file#*.}"
filename="${file%%.*}"
versioned_file=${filename}-${NGB_VERSION}.${ext}
cp -rf "$file" "${NGB_VERSION}/${versioned_file}"
if [[ $versioned_file == *"ngb-docs"* ]]; then
DOCS_VERSION=$versioned_file
fi
done
echo "Publishing ${NGB_VERSION} distribution"
aws s3 cp ${NGB_VERSION} s3://ngb-oss-builds/public/builds/${APPVEYOR_REPO_BRANCH}/${NGB_VERSION}/ --recursive
docker inspect --type=image "ngb:latest" &> /dev/null
if [ $? -ne 0 ]; then
echo "Docker image is not built"
exit 0
fi
if [[ "$APPVEYOR_REPO_BRANCH" == "release/"* ]]; then
docker login -u $DOCKER_USER -p $DOCKER_PSWD
docker tag ngb:latest $DOCKER_USER/ngb:$NGB_VERSION
docker push $DOCKER_USER/ngb:$NGB_VERSION
fi