-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-baton.sh
executable file
·77 lines (56 loc) · 2.87 KB
/
release-baton.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#This script requires two input parameter, 1)target release version 2)next development version.
#To run the script, enter a command like this: ./release-baton.sh <target-release-version> <next-development-version>
#After the script is executed, navigate to github to create a PR to merge your release branch
#and validate that the released version of baton-maven-plugin may be found in Maven Central
echo "////////////////////////////////////////////"
echo "//"
echo "// Use this script to run a release for Baton"
echo "//"
echo "////////////////////////////////////////////"
echo "//////////// Check out a release branch ////////////"
git checkout -b $1-release
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Unable to check out release branch!'; exit 1
fi
echo "/////////// Check there are no uncommitted local changes ///////////"
mvn scm:check-local-modification
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Uncommitted local changes detected!'; exit 1
fi
echo "/////////// Update POM versions to the target release version ///////////"
mvn versions:set -DnewVersion=$1 -DgenerateBackupPoms=false
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Unable to update POM versions to the target release version'; exit 1
fi
echo "/////////// Rebuild Baton modules (1) ///////////"
mvn clean install -Pbootstrap -Dmaven.build.cache.enabled=false && mvn clean install -pl :example-migration-configuration -Dmaven.build.cache.enabled=false && mvn clean initialize -Dmaven.build.cache.enabled=false
if [[ "$?" -ne 0 ]] ; then
echo 'Rebuilding Baton (1) failed!'; exit 1
fi
echo "/////////// Commit all changes that reflect the target release version and create a tag ///////////"
mvn scm:checkin -Dmessage=":memo: Prepare release baton-$1"
mvn scm:tag -Dtag=baton-$1
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Unable to commit changes and create a tag!'; exit 1
fi
echo "/////////// Deploy Baton to Maven Central ///////////"
mvn deploy -P ossrh-release -Dmaven.build.cache.enabled=false
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Unable to deploy Baton to Maven Central!'; exit 1
fi
echo "/////////// Update POM versions to the next development version ///////////"
mvn versions:set -DnewVersion=$2 -DgenerateBackupPoms=false
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Unable to update POM versions to the next development version!'; exit 1
fi
echo "/////////// Rebuild Baton modules (2) ///////////"
mvn clean install -Pbootstrap && mvn clean install -pl :example-migration-configuration && mvn clean initialize
if [[ "$?" -ne 0 ]] ; then
echo 'Rebuilding Baton (2) failed!'; exit 1
fi
echo "/////////// Commit all changes that reflect the next development iteration///////////"
mvn scm:checkin -Dmessage="Prepare for next development iteration"
if [[ "$?" -ne 0 ]] ; then
echo 'Process failed! Unable to commit changes for the next development iteration!'; exit 1
fi