Created
April 8, 2010 10:32
-
-
Save rowanmanning/359967 to your computer and use it in GitHub Desktop.
Simple build script for git archiving
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 | |
# DROP THIS IN A GIT REPO THEN CALL FROM THE COMMAND LINE | |
# ask for a version (tag) to build (if not provided) | |
if [ -z $1 ] | |
then | |
echo "Available versions:"; | |
echo $(git tag) | sed s/\ /,\ /g; | |
echo "Which version would you like to build?"; | |
read version; | |
else | |
version=$1; | |
fi | |
textversion=$version; | |
if [ -z $version ] | |
then | |
textversion="latest-`eval date +%Y\-%m\-%d`"; | |
fi | |
echo "Thanks, building into 'build-${textversion}.zip'"; | |
# archive the tag (or the current working tree) | |
if [ -z $version ] | |
then | |
git archive -o "build-${textversion}.zip" HEAD; | |
else | |
git archive --format=zip $version > "build-${textversion}.zip" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment