Debian Codegraph @

distribution/publish-snapshot

raw
1 #!/bin/bash
2
3 function user_continue() {
4 read -p "Do you want to continue? [y/n]" -n 1 -r
5 echo
6 if [[ ! $REPLY =~ ^[Yy]$ ]]; then
7 exit 1
8 fi
9 }
10
11 if [ "$#" -ne 1 ]; then
12 echo "USAGE: `basename $0` <repo-path>"
13 exit
14 fi
15
16 REPO_PATH="${1}"
17 SHA=`git rev-parse --verify HEAD`
18 echo "================================================================="
19 echo "BEGIN PUBLISH SNAPSHOT for revision ${SHA} at ${REPO_PATH}"
20 echo "================================================================="
21 user_continue
22
23 # Build snapshot jars
24 ./mvn_cmd --with-jdk8 clean
25 mvn package -Pjdk8 -Dmaven.javadoc.skip=true -B -V
26
27 # Pull latest from the maven repo
28 pushd ${REPO_PATH}
29 git pull
30 popd
31
32 # Deploy the artifact to the maven repo
33 mvn deploy -Pjdk8 -DskipTests -DaltDeploymentRepository=snapshot::default::file://${REPO_PATH}
34
35 # Push changes to the maven repo
36 pushd ${REPO_PATH}
37 git add .
38 git commit -a -m "Publish snapshot: ${SHA}"
39 git push origin master
40 popd
41
42 echo "Successfully published SNAPSHOT artifacts for ${SHA}"