-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
generate.sh
executable file
·118 lines (96 loc) · 2.39 KB
/
generate.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
GIT_MAIN_BRANCH='main'
GIT_REMOTE='origin'
show_syntax() {
echo "Usage: $0 <X.Y.Z>" >&2
exit 1
}
applyModules() {
for module in $@
do
local api="/api/modules/$module/apply-patch"
echo "curl -o /dev/null -s -w "%{http_code}\n" \
-X POST \
-H "accept: */*" \
-H "Content-Type: application/json" \
-d "$payload" \
"http://localhost:7471""$api""
local status_code=$(curl -o /dev/null -s -w "%{http_code}\n" \
-X POST \
-H "accept: */*" \
-H "Content-Type: application/json" \
-d "$payload" \
"http://localhost:7471""$api")
if [[ $status_code == '40'* || $status_code == '50'* ]]; then
echo "Error when calling API:" "$status_code" "$api"
exit 1
fi;
done
}
if [ "$#" -ne 1 ]; then
show_syntax
fi
version=$1
payload="$(sed -e "s?JHIPSTER_LITE_SAMPLE_APP_FOLDER?$(pwd)?g" litesample.json)"
echo "*** Git: update project..."
git switch $GIT_MAIN_BRANCH
git fetch $GIT_REMOTE
git rebase $GIT_REMOTE/$GIT_MAIN_BRANCH
echo "*** Deleting files and folders..."
find . -maxdepth 1 \
-not -name "generate.sh" \
-not -name "litesample.json" \
-type f -delete
rm -rf src
rm -rf node_modules
rm -rf documentation .husky .jhipster .mvn
echo "*** Applying modules..."
applyModules \
"init" \
"maven-java" \
"maven-wrapper" \
"java-base" \
"jacoco-with-min-coverage-check" \
"java-memoizers" \
"java-enums" \
"pagination-domain"
applyModules \
"application-service-hexagonal-architecture-documentation"
applyModules \
"spring-boot" \
"logs-spy" \
"spring-boot-mvc-empty" \
"spring-boot-tomcat" \
"spring-boot-actuator" \
"spring-boot-async" \
"spring-boot-devtools" \
"java-archunit" \
"git-information"
applyModules \
"prettier" \
"typescript" \
"frontend-maven-plugin" \
"vue-core"
applyModules \
"sonar-qube-java-backend-and-frontend"
applyModules \
"jpa-postgresql" \
"liquibase"
applyModules \
"spring-boot-oauth2" \
"spring-boot-oauth2-account" \
"springdoc-mvc-openapi" \
"springdoc-oauth2"
applyModules \
"spring-boot-cucumber-mvc" \
"spring-boot-cucumber-oauth2-authentication" \
"kipe-expression" \
"kipe-authorization" \
"sample-feature"
npm i
echo "*** Git: commit, tag and push tag..."
git add .
git commit -m "Release v${version}"
git tag -a v"${version}" -m "Release v${version}"
git push $GIT_REMOTE main
git push $GIT_REMOTE v"${version}"