-
Notifications
You must be signed in to change notification settings - Fork 126
/
release.sh
executable file
·244 lines (189 loc) · 4.97 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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#!/usr/bin/env bash
set -e
TOML_FILES="\
Cargo.toml \
tremor-api/Cargo.toml \
tremor-cli/Cargo.toml \
tremor-common/Cargo.toml \
tremor-influx/Cargo.toml \
tremor-pipeline/Cargo.toml \
tremor-script/Cargo.toml \
tremor-value/Cargo.toml
"
VERSION_TESTS="\
tremor-cli/tests/api-cli/command.yml \
tremor-cli/tests/api/command.yml\
"
DOCKER_FILES="\
Dockerfile.learn\
"
PACKAGES="\
tremor-common \
tremor-value \
tremor-script\
"
old=$1
new=$2
if [ -z "${old}" ] || [ -z "${new}" ]
then
echo "please run: $0 <old version> <new version>"
exit 1
fi
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" -ne 0 ]
then
git status
echo "There are unsaved changes in the repository, press CTRL-C to abort now or return to continue."
read -r answer
fi
echo -n "Release process from starting from '${old}' -> '${new}', do you want to continue? [y/N] "
read -r answer
case "${answer}" in
Y*|y*)
;;
*)
echo "Aborting"
exit 0
;;
esac;
echo "==> ${answer}"
echo -n "Updating TOML files:"
for toml in ${TOML_FILES}
do
echo -n " ${toml}"
sed -e "s/^version = \"${old}\"$/version = \"${new}\"/" -i.release "${toml}"
done
echo "."
echo -n "Updating Version Tests:"
for f in ${VERSION_TESTS}
do
echo -n " ${f}"
sed -e "s/- '{\"version\":\"${old}\"/- '{\"version\":\"${new}\"/" -i.release "${f}"
done
echo "."
echo -n "Updating Docker files:"
for f in ${DOCKER_FILES}
do
echo -n " ${f}"
sed -e "s;^FROM tremorproject/tremor:${old}$;FROM tremorproject/tremor:${new};" -i.release "${f}"
done
echo "."
echo "Updating CHANGELOG.md"
sed -e "s/^## Unreleased$/## ${new}/" -i.release "CHANGELOG.md"
echo "Testing the code ..."
cargo test --all
echo "Please review the following changes. (return to continue)"
read -r answer
git diff
echo "Do you want to Continue or Rollback? [c/R]"
read -r answer
case "${answer}" in
C*|c*)
git checkout -b "release-v${new}"
git commit -sa -m "Release v${new}"
git push --set-upstream origin "release-v${new}"
;;
*)
git checkout .
exit
;;
esac;
echo "Please open the following pull request we'll wait here continue when it is merged."
echo
echo " >> https://github.com/tremor-rs/tremor-runtime/pull/new/release-v${new} <<"
echo
echo "Once you continue we'll generate and push the release tag with the latest 'main'"
read -r answer
echo "Generating release tag v${new}"
git checkout main
git pull
git tag -a -m"Release v${new}" "v${new}"
git push --tags
echo "Publishing packages"
for pkg in ${PACKAGES}
do
cd "$pkg"
cargo test && cargo publish
cd ..
done
echo "Preparing docs"
mkdir -p temp
cd temp
git clone [email protected]:tremor-rs/tremor-www-docs.git
cd tremor-www-docs
echo "Updating Makefile"
sed -e "s/^TREMOR_VSN=v${old}$/TREMOR_VSN=v${new}/" -i.release "Makefile"
echo "Please review the following changes. (return to continue)"
read -r answer
echo "Do you want to Continue or Rollback? [c/R]"
read -r answer
case "${answer}" in
C*|c*)
git checkout -b "release-v${new}"
git commit -sa -m "Release v${new}"
git push --set-upstream origin "release-v${new}"
;;
*)
git checkout .
cd ../..
exit
;;
esac;
echo "Please open the following pull request we'll wait here continue when it is merged."
echo
echo " >> https://github.com/tremor-rs/tremor-www-docs/pull/new/release-v${new} <<"
echo
echo "Once you continue we'll generate and push the release tag with the latest 'main'"
read -r answer
echo "Generating release tag v${new}"
git checkout main
git pull
git tag -a -m"Release v${new}" "v${new}"
git push --tags
cd ../..
echo "Preparing TLS"
mkdir -p temp
cd temp
git clone [email protected]:tremor-rs/tremor-language-server.git
cd tremor-language-server
git submodule update --init
echo Updationg submodule
cd tremor-www-docs
git checkout "v${new}"
cd ..
toml="Cargo.toml"
echo -n "Updating TOML files:"
echo -n " ${toml}"
sed -e "s/^version = \"${old}\"$/version = \"${new}\"/" -e "s/^tremor-script = \"${old}\"$/tremor-script = \"${new}\"/" -i.release "${toml}"
echo "."
echo "Running tests"
cargo test --all
echo "Please review the following changes. (return to continue)"
read -r answer
git diff
echo "Do you want to Continue or Rollback? [c/R]"
read -r answer
case "${answer}" in
C*|c*)
git checkout -b "release-v${new}"
git commit -sa -m "Release v${new}"
git push --set-upstream origin "release-v${new}"
;;
*)
git checkout .
cd ../..
exit
;;
esac;
echo "Please open the following pull request we'll wait here continue when it is merged."
echo
echo " >> https://github.com/tremor-rs/tremor-language-server/pull/new/release-v${new} <<"
echo
echo "Once you continue we'll generate and push the release tag with the latest 'main'"
read -r answer
echo "Generating release tag v${new}"
git checkout main
git pull
git tag -a -m"Release v${new}" "v${new}"
git push --tags
cd ../..
echo "Congrats release v${new} is done!"