Created
May 24, 2018 07:22
-
-
Save hartym/a11792ac8f707f79f6b7c5532ded5fae to your computer and use it in GitHub Desktop.
sandbox.sh
This file contains hidden or 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 | |
# Exit if something fails | |
set -e | |
# Show everything | |
set -x | |
# Set version | |
export VERSION=`git describe` | |
git diff-index --quiet --cached HEAD -- || { | |
echo "repository not clean" | |
exit 1 | |
} | |
# Create temporary sandbox and trap removal at exit | |
SANDBOX=`mktemp -d` | |
function cleanup { | |
echo "Removing $SANDBOX" | |
rm -r $SANDBOX | |
} | |
trap cleanup EXIT | |
# Release path | |
RELEASE=$SANDBOX/release | |
pip install -U git-archive-all | |
git archive-all --force-submodules $RELEASE.tar | |
tar xf $RELEASE.tar -C $SANDBOX | |
# Execute | |
(cd $RELEASE; "$@") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment