conserver/package/make-and-stage-release

66 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
set -e
case $(sed --help 2>&1) in
*GNU*) sed_i () { sed -i "$@"; };;
*) sed_i () { sed -i '' "$@"; };;
esac
local=false && [ "$1" = "local" ] && local=true
[ -f conserver/version.h ] || { echo "you are in the wrong place" ; exit 1; }
ver=`./gen-version number`
if ! $local; then
echo "Ready to tag release v$ver (y/N)?"
read i
if [ "$i" = "y" ]; then
echo "Adding git tag v$ver"
git tag -a -m "Release $ver" v$ver
fi
fi
if [ ! -f ../conserver-$ver.tar.gz ] || $local; then
(
[ -d build ] && rm -rf build
mkdir build
archtag=v$ver
$local && archtag=HEAD
git archive --format=tar.gz --prefix=conserver-$ver/ $archtag | (cd build; tar zxf -)
cd build/conserver-$ver
../../package/setup-configure
rm -rf package
sed_i -e "/^%define ver/s| ver.*| ver $ver|" contrib/redhat-rpm/conserver.spec
sed_i -e "/^VERSION=/s|.*|VERSION=\"$ver\"|" contrib/solaris-package/pkginfo
)
$local && exit
echo "Creating ../conserver-$ver.tar.gz"
tar zcf ../conserver-$ver.tar.gz -C build conserver-$ver
rm -rf build
[ -f ../conserver-$ver.tar.gz.asc ] && rm ../conserver-$ver.tar.gz.asc
fi
if [ ! -f ../conserver-$ver.tar.gz.asc ]; then
echo "Signing ../conserver-$ver.tar.gz"
gpg -ab --local-user bryan@conserver.com ../conserver-$ver.tar.gz
fi
body="\`\`\`
`sed -ne '/^ver/,/^$/p' CHANGES | sed -e '/^$/,$d'`
\`\`\`"
ls -l ../conserver-$ver.tar.gz*
echo "Ready to push (y/N)?"
read i
if [ "$i" = "y" ]; then
git push --tags
githubrelease release bstansell/conserver create --name conserver-$ver --body "$body" v$ver ../conserver-$ver.tar.gz*
echo You can publish this release on the website or with:
echo " "githubrelease release bstansell/conserver publish v$ver
else
echo Ok, here is the command I would have used:
echo " "git push --tags
echo " "githubrelease release bstansell/conserver create --name conserver-$ver --body \""$body"\" v$ver ../conserver-$ver.tar.gz*
fi