forked from iris-connect/iris-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.prepare-release.sh
94 lines (69 loc) · 3.83 KB
/
.prepare-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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
printf "\n Build components and prepare release \n\n"
# Get version number from version tag if this given
VERSION=`echo $1 | cut -d'v' -f2`
MAJOR=`echo $VERSION | cut -d'.' -f1`
MINOR=`echo $VERSION | cut -d'.' -f2`
echo "version = $VERSION"
# expect commit sha as second parameter
COMMIT=$2
REGISTRY_BASE="tboegner"
printf "\n Build NGINX image \n\n"
docker build -t $REGISTRY_BASE/iris-client-nginx ./infrastructure/docker/nginx/
docker tag $REGISTRY_BASE/iris-client-nginx $REGISTRY_BASE/iris-client-nginx:$VERSION
docker tag $REGISTRY_BASE/iris-client-nginx $REGISTRY_BASE/iris-client-nginx:$MAJOR
docker tag $REGISTRY_BASE/iris-client-nginx $REGISTRY_BASE/iris-client-nginx:$MAJOR.$MINOR
printf "\n Build FE image \n\n"
docker build -t $REGISTRY_BASE/iris-client-frontend ./iris-client-fe/
docker tag $REGISTRY_BASE/iris-client-frontend $REGISTRY_BASE/iris-client-frontend:$VERSION
docker tag $REGISTRY_BASE/iris-client-frontend $REGISTRY_BASE/iris-client-frontend:$MAJOR
docker tag $REGISTRY_BASE/iris-client-frontend $REGISTRY_BASE/iris-client-frontend:$MAJOR.$MINOR
printf "\n Set version to POMs and build BFF image and JAR \n\n"
# Set new version in pom.xml using mvn versions:set command
mvn versions:set -DnewVersion=$VERSION -DprocessAllModules=true
# Package the new version and copy it to release folder
# These files will be upload to github by @semantic-release/github
mvn -B clean package spring-boot:repackage spring-boot:build-image -Dspring-boot.build-image.publish=false
mkdir release && cp ./iris-client-bff/target/*.jar release
# Generate third-party dependencies for BFF and move them to root
# File will be uploaded to github by @semantic-release/github
mvn -B license:aggregate-add-third-party
mv ./target/generated-sources/license/THIRD-PARTY.txt ./BFF-THIRD-PARTY-LICENSES.md
docker tag $REGISTRY_BASE/iris-client-bff:$VERSION $REGISTRY_BASE/iris-client-bff:latest
docker tag $REGISTRY_BASE/iris-client-bff:$VERSION $REGISTRY_BASE/iris-client-bff:$MAJOR
docker tag $REGISTRY_BASE/iris-client-bff:$VERSION $REGISTRY_BASE/iris-client-bff:$MAJOR.$MINOR
# Set new version with prefix in pom.xml to avoid accidentally overwriting the release images in Docker.io after the merge back into develop.
# These new pom.xml and changelog.md generated by @semantic-release/changelog
# will be commit it by @semantic-release/git
mvn versions:set -DnewVersion=$VERSION-POST_RELEASE -DoldVersion=$VERSION -DprocessAllModules=true
printf "\n Build FE ZIP \n\n"
cd ./iris-client-fe
npm ci
# Generate third-party dependencies for FE and move them to root
# File will be uploaded to github by @semantic-release/github
npm run generate-licenses
npm run convert-licenses
mv ./licenses.md ../FE-THIRD-PARTY-LICENSES.md
export VUE_APP_BUILD_ID=$COMMIT
export VUE_APP_VERSION_ID=$VERSION
export VUE_APP_API_BASE_URL="/api"
npm run build
cd dist && zip -qq -r ../../release/iris-client-fe-$VERSION.zip *
printf "\n Create ZIP of deployment scripts and instructions \n\n"
cd ../../infrastructure/deployment && zip -qq -r ../../release/deployment-$VERSION.zip * .*
cd ../../
printf "\n Push images and tags to docker registry \n\n"
docker push $REGISTRY_BASE/iris-client-bff:$VERSION
docker push $REGISTRY_BASE/iris-client-bff:latest
docker push $REGISTRY_BASE/iris-client-bff:$MAJOR
docker push $REGISTRY_BASE/iris-client-bff:$MAJOR.$MINOR
docker push $REGISTRY_BASE/iris-client-frontend:$VERSION
docker push $REGISTRY_BASE/iris-client-frontend:latest
docker push $REGISTRY_BASE/iris-client-frontend:$MAJOR
docker push $REGISTRY_BASE/iris-client-frontend:$MAJOR.$MINOR
docker push $REGISTRY_BASE/iris-client-nginx:$VERSION
docker push $REGISTRY_BASE/iris-client-nginx:latest
docker push $REGISTRY_BASE/iris-client-nginx:$MAJOR
docker push $REGISTRY_BASE/iris-client-nginx:$MAJOR.$MINOR
printf "\n COMPLETED: Build components and prepare release \n\n"
#printenv