set -e
VERSION=$1
PROJECT=pdf
git checkout develop
if [ "$VERSION" == "" ]; then
echo "A release needs a version number!"
exit 1
fi
DOCSUBDIR=$PROJECT/$VERSION
DOCURL=http://rasmus.krats.se/doc/$DOCSUBDIR/$PROJECT/
cat Cargo.toml \
| sed -e "s#^version.*#version = \"$VERSION\"#" \
| sed -e "s#^documentation.*#documentation = \"$DOCURL\"#" \
> Cargo.toml.new
mv Cargo.toml.new Cargo.toml
LOG=`mktemp --suffix=.buildlog`
eval `cat Cargo.toml|grep -E '^(name|version)' | sed -e 's/ = /=/'`
function error {
cat $LOG
exit 1
}
echo Testing ...
cargo test > $LOG 2>&1 || error
echo Making docs ...
cargo doc --no-deps > $LOG 2>&1 || error
echo Publishing docs ...
ssh lucien rm -rf $DOCSUBDIR
ssh lucien mkdir -p pubdoc/$PROJECT
scp -qr target/doc lucien:pubdoc/$DOCSUBDIR
echo Comitting the relase ...
git add Cargo.toml
git commit -m "Prepare release $VERSION"
git checkout master
git merge --no-ff -m "Release $VERSION" develop
git push --all
echo "Publishing the release to crates.io ..."
cargo publish