forked from awslabs/amazon-neptune-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·100 lines (74 loc) · 3 KB
/
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Copyright 2020 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file.
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions
# and limitations under the License.
VERSION_FILE="VERSION"
GIT_CMD=`which git`
GIT_BRANCH=`${GIT_CMD} branch | grep \* | cut -d' ' -f2`
if [ ! -f "$VERSION_FILE" ] ; then
echo "Version file not present. Please create and retry."
exit 1
fi
if [ "$GIT_BRANCH" != "master" ] ; then
echo "WARNING: Starting a release from a non-master branch."
fi
let NEW_VERSION=`cat $VERSION_FILE`+1
VERSION_STRING="1.${NEW_VERSION}"
echo $NEW_VERSION > $VERSION_FILE
echo "Starting release for $VERSION_STRING"
RELEASE_BRANCH="amazon-neptune-tools-$VERSION_STRING"
echo "Creating new release branch: $RELEASE_BRANCH"
$GIT_CMD checkout -b $RELEASE_BRANCH
#Utility script to build the jars to make a release.
ARTIFACT_DIR=`pwd`/artifacts
rm -rf $ARTIFACT_DIR
mkdir -p $ARTIFACT_DIR
MAVEN_ARTIFACTS="neo4j-to-neptune neptune-export neptune-gremlin-client"
for artifact in $MAVEN_ARTIFACTS; do
pushd $artifact >& /dev/null
mvn versions:set -DnewVersion=${VERSION_STRING} versions:update-child-modules
mvn clean
mvn package
#All of the jars are shaded. Only take the shaded, bundled jars.
for jar in `find . -name "*.jar" -print | grep -vE "SNAPSHOT|original|\-$VERSION_STRING"`; do
cp $jar $ARTIFACT_DIR
done
popd >& /dev/null
done
#Also get the non-shaded gremlin-client jar
cp "neptune-gremlin-client/gremlin-client/target/gremlin-client-$VERSION_STRING.jar" $ARTIFACT_DIR
#Build the neptune-python-utils artifact
pushd neptune-python-utils >& /dev/null
./build.sh
cp target/neptune_python_utils.zip $ARTIFACT_DIR
popd >& /dev/null
cp ./graphml2csv/graphml2csv.py $ARTIFACT_DIR
#drop-graph needs to be installed as a module
#cp ./drop-graph/drop-graph.py $ARTIFACT_DIR
${GIT_CMD} commit -a -m "POM version updates for $RELEASE_BRANCH"
echo "Creating Release Tag"
${GIT_CMD} tag -a $RELEASE_BRANCH -m "amazon-neptune-tools Release ${VERSION_STRING}"
repo=origin
echo "Pushing the release branch to $repo."
${GIT_CMD} push "${repo}" refs/heads/${RELEASE_BRANCH}
echo "Pushing the release tags to $repo."
${GIT_CMD} push "${repo}" refs/tags/${RELEASE_BRANCH}
#Update the VERSION on master
${GIT_CMD} checkout master
echo $NEW_VERSION > $VERSION_FILE
${GIT_CMD} pull $repo master
${GIT_CMD} commit -am "Incremented release version to `cat $VERSION_FILE`"
${GIT_CMD} push $repo master
#Return to the initial branch
${GIT_CMD} checkout ${GIT_BRANCH}
echo "To complete the release, upload the contents of artifacts/ to the ${RELEASE_BRANCH} tag on github: https://github.com/awslabs/amazon-neptune-tools/releases."