-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpublish-snapshot
executable file
·45 lines (37 loc) · 1.02 KB
/
publish-snapshot
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
#!/bin/bash
function user_continue() {
read -p "Do you want to continue? [y/n]" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
}
if [ "$#" -ne 1 ]; then
echo "USAGE: `basename $0` <repo-path>"
exit
fi
REPO_PATH="${1}"
SHA=`git rev-parse --verify HEAD`
echo "================================================================="
echo "BEGIN PUBLISH SNAPSHOT for revision ${SHA} at ${REPO_PATH}"
echo "================================================================="
user_continue
# update pom to release version
if ! mvn clean; then
echo "maven clean command failed, check your environment"
exit
fi
mvn package -Dmaven.javadoc.skip=true -B -V
# Clone the maven repo
pushd ${REPO_PATH}
git pull
popd
# Deploy the artifact to the maven repo
mvn deploy -DskipTests -DaltDeploymentRepository=snapshot::file://${REPO_PATH}
# Push changes to the maven repo
pushd ${REPO_PATH}
git add .
git commit -a -m "Publish snapshot: ${SHA}"
git push origin master
popd
echo "Successfully published SNAPSHOT artifacts for ${SHA}"