|
1 | 1 | #!/bin/bash |
2 | | -set -e |
| 2 | +set -euo pipefail |
3 | 3 |
|
4 | 4 | # shellcheck source=scripts/common.sh |
5 | 5 | source "$(dirname "$0")/common.sh" |
6 | 6 | repository=$(pwd)/distribution-repository |
7 | 7 |
|
8 | | -pushd git-repo >/dev/null |
9 | | -git fetch --tags --all >/dev/null |
10 | | -popd >/dev/null |
11 | | - |
12 | | -git clone git-repo stage-git-repo >/dev/null |
| 8 | +git clone git-repo stage-git-repo |
| 9 | +echo |
13 | 10 |
|
14 | 11 | pushd stage-git-repo >/dev/null |
| 12 | +git config user.name "Spring Buildmaster" |
| 13 | +git config user.email "[email protected]" |
15 | 14 |
|
16 | 15 | snapshotVersion=$(awk -F '=' '$1 == "version" { print $2 }' gradle.properties) |
17 | 16 | if [[ $RELEASE_TYPE == "M" ]]; then |
18 | | - stageVersion=$(get_next_milestone_release $snapshotVersion) |
19 | | - nextVersion=$snapshotVersion |
| 17 | + stageVersion=$(get_next_milestone_release "$snapshotVersion") |
| 18 | + nextVersion="$snapshotVersion" |
20 | 19 | elif [[ $RELEASE_TYPE == "RC" ]]; then |
21 | | - stageVersion=$(get_next_rc_release $snapshotVersion) |
22 | | - nextVersion=$snapshotVersion |
| 20 | + stageVersion=$(get_next_rc_release "$snapshotVersion") |
| 21 | + nextVersion="$snapshotVersion" |
23 | 22 | elif [[ $RELEASE_TYPE == "RELEASE" ]]; then |
24 | | - stageVersion=$(get_next_release $snapshotVersion) |
25 | | - nextVersion=$(bump_version_number $snapshotVersion) |
| 23 | + stageVersion=$(get_next_release "$snapshotVersion") |
| 24 | + nextVersion=$(bump_version_number "$snapshotVersion") |
26 | 25 | else |
27 | 26 | echo "Unknown release type $RELEASE_TYPE" >&2 |
28 | 27 | exit 1 |
29 | 28 | fi |
30 | 29 |
|
31 | | -echo "Staging $stageVersion (next version will be $nextVersion)" |
32 | | -sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties |
33 | | - |
34 | | -git config user.name "Spring Buildmaster" >/dev/null |
35 | | -git config user.email "[email protected]" >/dev/null |
36 | | -git add gradle.properties >/dev/null |
37 | | -git commit -m"Release v$stageVersion" >/dev/null |
38 | | -git tag -a "v$stageVersion" -m"Release v$stageVersion" >/dev/null |
| 30 | +echo "Current version is v$snapshotVersion" |
| 31 | +echo "Version to stage is v$stageVersion" |
| 32 | +echo "Next development version will be v$nextVersion" |
| 33 | +echo |
39 | 34 |
|
40 | | -./gradlew --no-daemon clean build install -Dmaven.repo.local="${repository}" |
| 35 | +git checkout -b "merge-on-success/$stageVersion" |
| 36 | +echo |
41 | 37 |
|
42 | | -git reset --hard HEAD^ >/dev/null |
43 | | -if [[ $nextVersion != $snapshotVersion ]]; then |
44 | | - echo "Setting next development version (v$nextVersion)" |
45 | | - sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties |
46 | | - git add gradle.properties >/dev/null |
47 | | - git commit -m"Next development version (v$nextVersion)" >/dev/null |
48 | | -fi |
| 38 | +echo "Tagging version being staged (v$stageVersion)" |
| 39 | +sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties |
| 40 | +git add gradle.properties |
| 41 | +git commit -m "Release v$stageVersion" |
| 42 | +git tag -a "v$stageVersion" -m "Release v$stageVersion" |
| 43 | +echo |
| 44 | + |
| 45 | +./gradlew --no-daemon clean install -Dmaven.repo.local="${repository}" |
| 46 | +echo |
| 47 | + |
| 48 | +echo "Setting next development version (v$nextVersion)" |
| 49 | +sed -i "s/version=$stageVersion/version=$nextVersion/" gradle.properties |
| 50 | +git add gradle.properties |
| 51 | +git commit -m "Next development version (v$nextVersion)" |
| 52 | +echo |
49 | 53 |
|
50 | 54 | echo "DONE" |
51 | 55 |
|
|
0 commit comments