Skip to content

Commit

Permalink
Add publish snapshot script.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfish3r committed Jan 3, 2022
1 parent 5285b5e commit bef8a9f
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions publish-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/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
mvn clean && 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::default::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}"

0 comments on commit bef8a9f

Please sign in to comment.