File: publish-snapshot

package info (click to toggle)
cryptacular 1.2.7-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,608 kB
  • sloc: java: 10,364; xml: 715; sh: 135; makefile: 2
file content (45 lines) | stat: -rwxr-xr-x 1,048 bytes parent folder | download | duplicates (2)
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}"