Skip to content

Commit 00b78cb

Browse files
committed
release-version: clean up release-only files
To avoid these becoming committed to the mainline repository branch, we now do two things: 1. If they are present at the beginning, remove them. 2. After the release process completes, delete the newly generated ones.
1 parent c2b56cf commit 00b78cb

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

release-version.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,21 @@ test "$FETCH_HEAD" = HEAD ||
208208
test "$FETCH_HEAD" = "$(git merge-base $FETCH_HEAD $HEAD)" ||
209209
die "'$defaultBranch' is not up-to-date"
210210

211+
# Check for release-only files committed to the main branch.
212+
for release_file in release.properties pom.xml.releaseBackup
213+
do
214+
if [ -e "$release_file" ]
215+
then
216+
echo "=========================================================================="
217+
echo "NOTE: $release_file was committed to source control. Removing now."
218+
echo "=========================================================================="
219+
git rm -rf "$release_file" &&
220+
git commit "$release_file" \
221+
-m 'Remove $release_file' \
222+
-m 'It should only exist on release tags.'
223+
fi
224+
done
225+
211226
# Ensure that schema location URL uses HTTPS, not HTTP.
212227
if grep -q http://maven.apache.org/xsd/maven-4.0.0.xsd pom.xml >/dev/null 2>/dev/null
213228
then
@@ -312,5 +327,8 @@ $DRY_RUN git checkout @{-1} &&
312327
if test -z "$SKIP_PUSH"
313328
then
314329
$DRY_RUN git push "$REMOTE" HEAD $tag
315-
fi ||
316-
exit
330+
fi
331+
332+
# Remove files generated by the release process. They can end up
333+
# committed to the mainline branch and hosing up later releases.
334+
$DRY_RUN rm -f release.properties pom.xml.releaseBackup

0 commit comments

Comments
 (0)