-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·210 lines (178 loc) · 6.58 KB
/
release.sh
File metadata and controls
executable file
·210 lines (178 loc) · 6.58 KB
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
#!/bin/bash
#
# CodeOwners Tools
# Copyright (C) 2023-2025 Niels Basjes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Release procedure.
# This uses the maven-release-plugin which has been configured to ONLY modify the local git repo.
# ----------------------------------------------------------------------------------------------------
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
echo "PWD: ${SCRIPTDIR}"
cd "${SCRIPTDIR}" || ( echo "This should not be possible" ; exit 1 )
# Working directory is now the root of the project
# ----------------------------------------------------------------------------------------------------
#https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# Reset
export Color_Off='\e[0m' # Text Reset
# High Intensity
export IRed='\e[0;91m' # Red
export IYellow='\e[0;93m' # Yellow
export IBlue='\e[0;94m' # Blue
export IWhite='\e[0;97m' # White
# Bold High Intensity
export BIRed='\e[1;91m' # Red
export BIYellow='\e[1;93m' # Yellow
export BIGreen='\e[1;92m' # Green
export BIBlue='\e[1;94m' # Blue
function info() {
echo -e "${Color_Off}${IWhite}[${BIBlue}INFO${IWhite}] ${Color_Off}${1}"
}
function pass() {
echo -e "${Color_Off}${IWhite}[${BIGreen}PASS${IWhite}] ${Color_Off}${1}"
}
function warn() {
echo -e "${Color_Off}${IWhite}[${BIYellow}WARN${IWhite}] ${IYellow}${1}${Color_Off}"
}
function fail() {
echo -e "${Color_Off}${IWhite}[${BIRed}FAIL${IWhite}] ${IRed}${1}${Color_Off}"
}
function die() {
echo -e "${Color_Off}"
echo -e "${IWhite}[${BIRed}FAIL${IWhite}] ${IYellow}/========================================================================"
echo -e "${IWhite}[${BIRed}FAIL${IWhite}] ${IYellow}| ${BIRed} ---------->>> PROCESS WAS ABORTED <<<---------- ${IYellow}"
echo -e "${IWhite}[${BIRed}FAIL${IWhite}] ${IYellow}| ${BIRed} $* ${IYellow}"
echo -e "${IWhite}[${BIRed}FAIL${IWhite}] ${IYellow}\\========================================================================"
echo -e "${Color_Off}"
exit 1
}
# ----------------------------------------------------------------------------------------------------
# Pre flight checks
## Ensure all has been committed
info "Checking tree status"
if [[ -z $(git status -s) ]]
then
pass "Tree is clean"
else
git status
die "Tree is dirty, must commit everything"
fi
## Ensure we have all upstream updates (like patches from Renovate)
info "Checking up to date status"
git pull
gitPullStatus=$?
if [ ${gitPullStatus} -ne 0 ];
then
fail "We just received changes."
exit ${gitPullStatus}
else
pass "Everything is up to date."
fi
# ----------------------------------------------------------------------------------------------------
# Forcing a manual gpg signing action to ensure the password is known
(
cd /tmp || die "Unable to enter /tmp"
echo x > ReleaseProcess-$$.txt
gpg --clearsign ReleaseProcess-$$.txt
rm ReleaseProcess-$$.txt ReleaseProcess-$$.txt.asc
)
info "GPG workaround: Starting"
runGpgSignerInBackGround(){
while : ; do date ; echo "test" | gpg --clearsign ; sleep 10s ; done
}
runGpgSignerInBackGround > /dev/null 2>&1 &
GpgSignerPID=$!
info "GPG workaround: Running (PID=${GpgSignerPID})"
killSigner() {
info "GPG workaround: Killing (PID=${GpgSignerPID})"
kill ${GpgSignerPID}
info "GPG workaround: Killed"
}
trap killSigner EXIT
trap killSigner SIGINT
# ----------------------------------------------------------------------------------------------------
## Prepare the release: Make releasable version and make tag.
info "Doing release:prepare"
mvn release:prepare -B
prepareStatus=$?
if [ ${prepareStatus} -ne 0 ];
then
fail "Release prepare failed."
exit ${prepareStatus}
else
pass "Release prepare Success."
fi
# ----------------------------------------------------------------------------------------------------
# Check if build for this tag is reproducible
git checkout "$(git describe --abbrev=0)"
# ----------------------------------------------------------------------------------------------------
info "Publishing for reproduction check to Local repo"
mvn clean install -PpackageForRelease -PskipQuality
reproCheckPublishStatus=$?
if [ ${reproCheckPublishStatus} -ne 0 ];
then
git switch -
fail "Publishing for reproduction check failed."
exit ${reproCheckPublishStatus}
else
pass "Publishing for reproduction check Success."
fi
# ----------------------------------------------------------------------------------------------------
info "Checking build reproducibility ... "
mvn clean verify -PpackageForRelease -PskipQuality -PartifactCompare
reproducibleStatus=$?
git switch -
if [ ${reproducibleStatus} -ne 0 ];
then
fail "Build is NOT reproducible."
exit ${reproducibleStatus}
else
pass "Build is reproducible."
fi
# ----------------------------------------------------------------------------------------------------
# Actually run the release: Effectively mvn deploy towards Sonatype
info "Doing release:perform"
mvn release:perform
performStatus=$?
if [ ${performStatus} -ne 0 ];
then
fail "Release perform failed."
exit ${performStatus}
else
pass "Release perform Success."
fi
# ----------------------------------------------------------------------------------------------------
#
# Now check SONATYPE
#
RELEASEVERSION=$(git describe --abbrev=0| sed 's/^v//')
info "Now verify Sonatype to release version ${RELEASEVERSION}"
info "Go to https://central.sonatype.com/publishing/deployments"
warn "Press any key abort or 'c' to continue and update the website"
read -n 1 k <&1
if [[ $k = c ]] ;
then
pass "Release worked, pushing results"
else
die "Aborting, nothing was pushed."
fi
# ----------------------------------------------------------------------------------------------------
## Update the top of the website frontpage
vim README.md
git commit -m"docs: Updated website after release" README.md
warn "Now go and manually push it all"
# ----------------------------------------------------------------------------------------------------
echo "git push"
echo "git push --tags"
# ----------------------------------------------------------------------------------------------------