mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-16 08:50:50 +00:00
48 lines
1.1 KiB
Bash
48 lines
1.1 KiB
Bash
|
#!/bin/sh
|
||
|
#
|
||
|
# A script to bump the version number on all Cargo.toml files etc in
|
||
|
# an atomic fashion.
|
||
|
|
||
|
VERSION=$(
|
||
|
ls lalrpop*/Cargo.toml | \
|
||
|
xargs grep "# LALRPOP$" | \
|
||
|
perl -p -i -e 's/.*version = "([0-9.]+)" # LALRPOP$/$1/' |
|
||
|
sort |
|
||
|
uniq)
|
||
|
|
||
|
if [ $(echo $VERSION | wc -w) != 1 ]; then
|
||
|
echo "Error: inconsistent versions detected across Cargo.toml files!"
|
||
|
echo "$VERSION"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "Found consistent version $VERSION"
|
||
|
|
||
|
BASE_DIR="$PWD"
|
||
|
|
||
|
function publish_fail {
|
||
|
printf "ERROR\n"
|
||
|
cat $TMPDIR/publish-log
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
function publish {
|
||
|
printf "Publishing %s..." "$1"
|
||
|
cd $1
|
||
|
cargo publish >& $TMPDIR/publish-log || publish_fail $1
|
||
|
cd $BASE_DIR
|
||
|
printf "OK\n"
|
||
|
}
|
||
|
|
||
|
publish lalrpop-util
|
||
|
publish lalrpop-snap
|
||
|
publish lalrpop
|
||
|
|
||
|
printf "Updated README version..."
|
||
|
perl -p -i -e 's/^version = "[0-9.]+"$/version = "'$VERSION'"/' \
|
||
|
README.md >& $TMPDIR/publish-log || publish_fail
|
||
|
git add README.md >& $TMPDIR/publish-log || publish_fail
|
||
|
printf "OK\n"
|
||
|
|
||
|
printf "\nAll set. Do not forget to commit new README.md.\n"
|