Last active
December 20, 2015 20:29
-
-
Save talios/6190640 to your computer and use it in GitHub Desktop.
Stage an Apache Maven artifact release into a separate repository based on the git commits SHA1, so to allow for interim, unmerged dependencies to resolve for other users.
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/sh | |
if ! git diff-index --quiet HEAD --; then | |
echo "Git is dirty, clean up your mess!" | |
exit 1 | |
fi | |
VERSION=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml` | |
ARTIFACTID=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:artifactId" pom.xml` | |
SHA1=`git rev-parse HEAD` | |
mvn -q -o versions:set -DnewVersion=$SHA1 | |
echo "Building $ARTIFACTID $VERSION for staging with version $SHA1" | |
mvn -q -o clean install | |
echo "Deploying $ARTIFACTID $VERSION to staging with version $SHA1" | |
mvn -q -o install deploy:deploy -DaltDeploymentRepository=staging::default::http://..../repositories/staging/ | |
git reset --hard | |
git clean -fd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment