Skip to content

Commit 81e6192

Browse files
committed
Introduce --dry-run mode for release-version.sh
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent b480f1c commit 81e6192

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

release-version.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ TAG=
2323
DEV_VERSION=
2424
EXTRA_ARGS=
2525
ALT_REPOSITORY=
26+
DRY_RUN=
2627
while test $# -gt 0
2728
do
2829
case "$1" in
30+
--dry-run) DRY_RUN=echo;;
2931
--no-batch-mode) BATCH_MODE=;;
3032
--skip-push) SKIP_PUSH=t;;
3133
--skip-deploy) SKIP_DEPLOY=t;;
@@ -113,31 +115,36 @@ test "$FETCH_HEAD" = "$(git merge-base $FETCH_HEAD $HEAD)" ||
113115
die "'master' is not up-to-date"
114116

115117
# Prepare new release without pushing (requires the release plugin >= 2.1)
116-
mvn $BATCH_MODE release:prepare -DpushChanges=false -Dresume=false $TAG \
118+
$DRY_RUN mvn $BATCH_MODE release:prepare -DpushChanges=false -Dresume=false $TAG \
117119
$DEV_VERSION -DreleaseVersion="$VERSION" \
118120
"-Darguments=${EXTRA_ARGS# }" &&
119121

120122
# Squash the two commits on the current branch into one
121-
git reset --soft HEAD^^ &&
123+
$DRY_RUN git reset --soft HEAD^^ &&
122124
if ! git diff-index --cached --quiet --ignore-submodules HEAD --
123125
then
124-
git commit -s -m "Bump to next development cycle"
126+
$DRY_RUN git commit -s -m "Bump to next development cycle"
125127
fi &&
126128

127129
# push the current branch and the tag
128-
tag=$(sed -n 's/^scm.tag=//p' < release.properties) &&
130+
if test -z "$DRY_RUN"
131+
then
132+
tag=$(sed -n 's/^scm.tag=//p' < release.properties)
133+
else
134+
tag="<tag>"
135+
fi &&
129136
test -n "$tag" &&
130137
if test -z "$SKIP_PUSH"
131138
then
132-
git push "$REMOTE" HEAD &&
133-
git push "$REMOTE" $tag
139+
$DRY_RUN git push "$REMOTE" HEAD &&
140+
$DRY_RUN git push "$REMOTE" $tag
134141
fi ||
135142
exit
136143

137144
if test -z "$SKIP_DEPLOY"
138145
then
139-
git checkout $tag &&
140-
mvn -DperformRlease clean verify &&
141-
mvn $ALT_REPOSITORY -DperformRelease -DupdateReleaseInfo=true deploy &&
142-
git checkout @{-1}
146+
$DRY_RUN git checkout $tag &&
147+
$DRY_RUN mvn -DperformRlease clean verify &&
148+
$DRY_RUN mvn $ALT_REPOSITORY -DperformRelease -DupdateReleaseInfo=true deploy &&
149+
$DRY_RUN git checkout @{-1}
143150
fi

0 commit comments

Comments
 (0)