Skip to content

Commit 25ed6c1

Browse files
heatherlpjt-nti
authored andcommitted
[FABN-1320] Fix git_tag.sh
- so that it parses the build.gradle version - also specify a version and add a task to print it in the root level build.gradle Change-Id: I376bb53765cf21a715d084719eac2345ba44885d Signed-off-by: heatherlp <[email protected]> Signed-off-by: James Taylor <[email protected]>
1 parent 4371d07 commit 25ed6c1

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

build.gradle

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
apply plugin: 'idea'
88
apply plugin: 'eclipse-wtp'
99

10+
version = '2.0.0-SNAPSHOT'
11+
1012
allprojects {
1113
repositories {
1214
mavenLocal()
@@ -22,7 +24,7 @@ subprojects {
2224
apply plugin: 'maven'
2325

2426
group = 'org.hyperledger.fabric-chaincode-java'
25-
version = '2.0.0-SNAPSHOT'
27+
version = rootProject.version
2628

2729
sourceCompatibility = 1.8
2830
targetCompatibility = 1.8
@@ -37,7 +39,12 @@ subprojects {
3739
testCompile 'com.github.stefanbirkner:system-rules:1.17.0'
3840
}
3941

40-
tasks.withType(JavaCompile) {
41-
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
42-
}
42+
tasks.withType(JavaCompile) {
43+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
4344
}
45+
46+
}
47+
48+
task printVersionName() {
49+
println rootProject.version
50+
}

scripts/gittag.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
# Exit on first error, print all commands.
7+
set -e
8+
set -o pipefail
9+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
10+
11+
# release name
12+
RELEASE=release-1.4
13+
14+
function abort {
15+
echo "!! Exiting shell script"
16+
echo "!!" "$1"
17+
exit -1
18+
}
19+
20+
# Run printVersionName task in the root directory, grab the first line and remove anything after the version number
21+
VERSION=$(cd ../ && ./gradlew -q printVersionName | gsed -n 1p | gsed -r "s/-.*//")
22+
23+
echo New version string will be v${VERSION}
24+
25+
# do the release notes for this new version exist?
26+
if [[ -f "${DIR}/release_notes/v${VERSION}.txt" ]]; then
27+
echo "Release notes exist, hope they make sense!"
28+
else
29+
abort "No releases notes under the file ${DIR}/release_notes/v${NEW_VERSION}.txt exist";
30+
fi
31+
32+
git checkout "${RELEASE}"
33+
git pull
34+
git tag -a "v${VERSION}" `git log -n 1 --pretty=oneline | head -c7` -F release_notes/"v${VERSION}".txt
35+
git push origin v${VERSION} HEAD:refs/heads/${RELEASE}

0 commit comments

Comments
 (0)