-
Notifications
You must be signed in to change notification settings - Fork 51
/
create_release.sh
executable file
·67 lines (56 loc) · 1.92 KB
/
create_release.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
#!/usr/bin/env bash
#
# Usage of this script:
# 1. Make sure develop branch build is up to date and has no failing tests.
# 2. Switch to master and make sure it up to date and has no failing tests.
# 3. Run this script to:
# - Merge develop in master (without fetch)
# - Creates a release on master branch
# - Merge master into develop (without fetch)
# - Push master and develop branch to remote.
#
if [ "$#" -ne 2 ]
then
echo "Please specify the release version number and the next snapshot for this release:"
echo " ./create_release.sh 1.8 1.9-SNAPSHOT"
echo ""
echo "The current version recorded in VERSION.TXT is "
cat src/main/java/com/rolfje/anonimatron/version.txt
exit
fi
# Exit when a command fails.
set -e
# ------------------------------------------ Update master and create release
git checkout master
git merge develop
# Set the new versions
echo $1 > src/main/java/com/rolfje/anonimatron/version.txt
mvn versions:set -DnewVersion=$1
# Deploy the release to mavenrepo
mvn clean deploy -P release
# Commit the release and tag it.
mvn versions:commit
git add pom.xml src/main/java/com/rolfje/anonimatron/version.txt
git commit -m "Release $1"
git tag "v$1"
git push origin "v$1"
# ------------------------------------------------- Update develop
git checkout develop
git merge master
# Set the version to the new SNAPSHOT version
echo $2 > src/main/java/com/rolfje/anonimatron/version.txt
mvn versions:set -DnewVersion=$2
mvn versions:commit
# Commit the SNAPSHOT version to git
git add pom.xml src/main/java/com/rolfje/anonimatron/version.txt
git commit -m "Update version to $2"
git push
# Sign the zip file
gpg -ab --default-key 45E2A5E085182DC26EFEF6E796BB2760490D54DD target/anonimatron*.zip
echo "The files to upload for this release are:"
echo
ls -l target/anonimatron*.zip*
echo
echo "When creating a release, github automatically adds src zip"
echo "files, you only need to upload the binary."
echo