1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#!/bin/sh
set -e
type git || exit 1
export TVERSION="$1"
commit=master
test -z "$2" || commit="$2"
if test -z "$TVERSION"; then
echo "usage: $0 <VERSION> [commit]"
echo " if commit is omitted, 'master' is used"
exit 1
fi
if ! git diff-index --quiet HEAD --; then
echo "You have local changes, please commit, reset or stash them"
exit 1
fi
branchname="build-$TVERSION"
git checkout -b "$branchname" "$commit"
echo "$TVERSION" > VERSION.txt
git commit VERSION.txt -m "$TVERSION"
git tag RELEASE.$TVERSION
# Create the tar.gz
make dist
# Return to master
git checkout master
# Cleanup
# Delete temporary branch
git branch -D "$branchname"
# Delete the temporary tag
git tag -d RELEASE.$TVERSION
|