Created
December 13, 2011 18:41
-
-
Save gnp/1473281 to your computer and use it in GitHub Desktop.
Generate source tarball of Maven + Git project
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 | |
echo "Determining Git branch..." | |
BRANCH=`git branch | grep '^[*] ' | sed -e 's/^[*] //'` | |
echo "Determining Maven project artifactId..." | |
ARTIFACT=`mvn help:evaluate -Dexpression=project.artifactId | grep -v '^\[INFO\]'` | |
echo "Determining Maven project version..." | |
VERSION=`mvn help:evaluate -Dexpression=project.version | grep -v '^\[INFO\]'` | |
PREFIX="$ARTIFACT-$VERSION" | |
TARBALL="$PREFIX.tar.gz" | |
echo "Archiving branch '$BRANCH' to $TARBALL..." | |
git archive --format=tar --prefix=$PREFIX $BRANCH | gzip -9 > $TARBALL | |
echo "Done! Note: Archive only contains the *committed* versions of files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment