Last active
March 16, 2016 14:49
-
-
Save hvalls/d45db1638a14a5acdae9 to your computer and use it in GitHub Desktop.
Deployment for Maven projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ #$ -lt 1 ]; then | |
printf "Usage: $0 <environment>" | |
exit | |
fi | |
deploy_host=x.x.x.x | |
artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId | grep -v '\[') | |
current_version=$(mvn help:evaluate -Dexpression=project.version | grep -v '\[') | |
IFS="-" read -r -a current_version <<< "$current_version" | |
release_version_prop="${current_version[0]}" #Remove -SNAPSHOT from current_version | |
printf "What is SCM release tag or label? $release_version_prop :" | |
read -r release_version | |
if [ -z "$release_version" ]; then | |
release_version="$release_version_prop" | |
fi | |
mvn release:prepare -DreleaseVersion="$release_version" | |
mvn release:perform | |
printf "Deploying $artifact $release_version..." | |
ssh root@$deploy_host "deploy $artifact_id $release_version $1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment