Skip to content

Commit 51e7367

Browse files
authored
CU-869awf45h: Update patch release script for more flexibility. (#182)
This will allow a minor release after a pre-release to be pushed out without any cherry-picked cahnges. Normally, with a patch release, you would expect to cherry-pick at least something, but with a pre-release that is being spun out as a full release, that's not always the case. So this PR will allow no cherry-picks only if the version being created is a minor release after a pre-release for said minor release. PS: The naming of the 2 release scripts isn't great. The prepare_patch_release.sh script is designed to deal with anything that already had a release within the same minor release cycle (i.e 2.2.1 after 2.2.0, but also 2.2.0 after 2.2.0a1 or 2.2.0rc1)
1 parent b7711c8 commit 51e7367

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

medcat-v2/.release/prepare_patch_release.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,22 @@ if $DRY_RUN; then
117117
git checkout "$ORIGINAL_REF" >/dev/null 2>&1 || error_exit "Could not return to original branch"
118118
fi
119119

120+
# Validate cherry-pick hashes
121+
if [[ ${#CHERRYPICK_HASHES[@]} -eq 0 ]]; then
122+
echo "EMPTY"
123+
# Allow empty list only if this is a .0 release and a prerelease exists
124+
if [[ "$VERSION_PATCH" == "0" ]]; then
125+
if ! git tag -l "medcat/v${VERSION_MAJOR_MINOR}.0[a-z]*" | grep -q .; then
126+
error_exit "No cherry-pick hashes provided for $VERSION — expected at least one unless this is a .0 release after a pre-release."
127+
fi
128+
else
129+
error_exit "No cherry-pick hashes provided for $VERSION — expected at least one for patch releases."
130+
fi
131+
fi
132+
133+
120134
# do the cherry-picking
121-
for HASH in "${CHERRYPICK_HASHES[@]}"; do
135+
for HASH in "${CHERRYPICK_HASHES[@]-}"; do
122136
if ! run_or_echo git cherry-pick "$HASH"; then
123137
echo "Conflict detected when cherry-picking $HASH."
124138
echo

0 commit comments

Comments
 (0)