Skip to content

Commit 9e899e6

Browse files
author
madoci
committed
new release script
1 parent 7bf9167 commit 9e899e6

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ jobs:
1313
if: tag IS present
1414
before_script:
1515
- cp ./.travis/settings.xml $HOME/.m2
16-
- ls $HOME/.m2
17-
- cat $HOME/.m2/settings.xml
1816
script:
1917
- mvn deploy -B
18+
- ls target
2019
deploy:
2120
provider: releases
2221
api_key: $GITHUB_TOKEN
@@ -25,9 +24,6 @@ jobs:
2524
skip_cleanup: true
2625
on:
2726
tags: true
28-
after_deploy:
29-
- bash scripts/setup_git.sh
30-
- bash scripts/prepare_snapshot.sh
3127

3228
cache:
3329
directories:

scripts/release.sh

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ then
2121
tag=$DEFAULT_TAG
2222
fi
2323

24-
# Extracting project name from POM and deducing release name
25-
PROJECT_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)
26-
DEFAULT_NAME="$PROJECT_NAME $version"
24+
# Deduce next development version
25+
SPLIT_VERSION=${version//./ }
26+
IFS=' '
27+
read -ra SPLIT_VERSION <<< "$SPLIT_VERSION"
28+
NEW_MINOR=$( expr ${SPLIT_VERSION[1]} + 1 )
29+
DEFAULT_SNAPSHOT="${SPLIT_VERSION[0]}.$NEW_MINOR-SNAPSHOT"
2730

28-
echo -n "Release name ? ($DEFAULT_NAME) : "; read name
29-
if [ -z $name ]
31+
echo -n "Next development version ? ($DEFAULT_SNAPSHOT) : "; read snapshot
32+
if [ -z $snapshot ]
3033
then
31-
name=$DEFAULT_NAME
34+
snapshot=$DEFAULT_SNAPSHOT
3235
fi
3336

34-
echo "Preparing release $version as \"$name\" with tag $tag"
37+
echo "Preparing release $version with tag $tag"
3538

3639
set -x
3740

@@ -48,5 +51,15 @@ git commit -m "Prepare release $version"
4851
git push
4952

5053
# Tag release
51-
git tag -a $tag -m "$name"
54+
git tag $tag
5255
git push --tags
56+
57+
echo "Preparing next release $version with tag $tag"
58+
59+
# Set the next development version in POM file
60+
mvn versions:set -DnewVersion=$snapshot
61+
62+
# Commit new POM
63+
git add .
64+
git commit -m "Prepare for next development version $snapshot"
65+
git push

0 commit comments

Comments
 (0)