Skip to content

Instantly share code, notes, and snippets.

@rowanmanning
Created April 8, 2010 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowanmanning/359967 to your computer and use it in GitHub Desktop.
Save rowanmanning/359967 to your computer and use it in GitHub Desktop.
Simple build script for git archiving
#!/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