Skip to content

Commit 1a6e4b9

Browse files
committed
Update make-release to bump to bug fix version
Signed-off-by: David Kwon <dakwon@redhat.com>
1 parent cec7215 commit 1a6e4b9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

make-release.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,34 @@ release() {
285285
git fetch origin "${X_BRANCH}:${X_BRANCH}" || true
286286
git checkout "${X_BRANCH}"
287287

288+
# Bugfix release (patch != 0, e.g. v0.40.1): bump the z digit from version/version.go, then
289+
# sync CSV and image tags before building OLM bundles. --version must match the incremented
290+
# SemVer (e.g. branch at v0.40.0 -> v0.40.1). If the branch is already bumped to VERSION, skip.
291+
if [[ "${VERSION##*.}" != "0" ]]; then
292+
echo "[INFO] Bugfix release: preparing ${X_BRANCH} for ${VERSION}"
293+
SOURCE_VER=$(grep '^[[:space:]]*Version = ' version/version.go | sed -n 's/.*"\(v[0-9]*\.[0-9]*\.[0-9]*\)".*/\1/p')
294+
if [[ "${SOURCE_VER}" == "${VERSION}" ]]; then
295+
echo "[INFO] Branch already at ${VERSION}; skipping version bump"
296+
else
297+
if [[ "${SOURCE_VER#v}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
298+
BASE="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
299+
NEXT="${BASH_REMATCH[3]}"
300+
(( NEXT=NEXT+1 ))
301+
else
302+
echo "[ERROR] Could not parse Version in version/version.go: ${SOURCE_VER}"
303+
exit 1
304+
fi
305+
NEXT_VERSION_Z="v${BASE}.${NEXT}"
306+
if [[ "${NEXT_VERSION_Z}" != "${VERSION}" ]]; then
307+
echo "[ERROR] Bugfix version mismatch: version.go has ${SOURCE_VER} (next patch would be ${NEXT_VERSION_Z}); release --version is ${VERSION}"
308+
exit 1
309+
fi
310+
update_version "${NEXT_VERSION_Z}"
311+
update_images "${NEXT_VERSION_Z}"
312+
git_commit_and_push "chore: release: bump to ${NEXT_VERSION_Z} in ${X_BRANCH}" "ci-bump-${X_BRANCH}-${NEXT_VERSION_Z}"
313+
fi
314+
fi
315+
288316
# Build bundle and index images
289317
$DRY_RUN build/scripts/build_index_image.sh \
290318
--release \

0 commit comments

Comments
 (0)