|
23 | 23 | DEV_VERSION= |
24 | 24 | EXTRA_ARGS= |
25 | 25 | ALT_REPOSITORY= |
| 26 | +DRY_RUN= |
26 | 27 | while test $# -gt 0 |
27 | 28 | do |
28 | 29 | case "$1" in |
| 30 | + --dry-run) DRY_RUN=echo;; |
29 | 31 | --no-batch-mode) BATCH_MODE=;; |
30 | 32 | --skip-push) SKIP_PUSH=t;; |
31 | 33 | --skip-deploy) SKIP_DEPLOY=t;; |
@@ -113,31 +115,36 @@ test "$FETCH_HEAD" = "$(git merge-base $FETCH_HEAD $HEAD)" || |
113 | 115 | die "'master' is not up-to-date" |
114 | 116 |
|
115 | 117 | # 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 \ |
117 | 119 | $DEV_VERSION -DreleaseVersion="$VERSION" \ |
118 | 120 | "-Darguments=${EXTRA_ARGS# }" && |
119 | 121 |
|
120 | 122 | # Squash the two commits on the current branch into one |
121 | | -git reset --soft HEAD^^ && |
| 123 | +$DRY_RUN git reset --soft HEAD^^ && |
122 | 124 | if ! git diff-index --cached --quiet --ignore-submodules HEAD -- |
123 | 125 | then |
124 | | - git commit -s -m "Bump to next development cycle" |
| 126 | + $DRY_RUN git commit -s -m "Bump to next development cycle" |
125 | 127 | fi && |
126 | 128 |
|
127 | 129 | # 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 && |
129 | 136 | test -n "$tag" && |
130 | 137 | if test -z "$SKIP_PUSH" |
131 | 138 | 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 |
134 | 141 | fi || |
135 | 142 | exit |
136 | 143 |
|
137 | 144 | if test -z "$SKIP_DEPLOY" |
138 | 145 | 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} |
143 | 150 | fi |
0 commit comments