Add bump-version.sh

This commit is contained in:
Kogia-sima 2022-02-13 09:49:12 +09:00
parent 02793d7b78
commit 43ebe1865e
1 changed files with 28 additions and 0 deletions

28
scripts/bump-version.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e
if [ $# != 1 ]; then
echo "Usage: bump_version.sh <new version>" 1>&2
exit 1
fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_DIR/..
OLD_VERSION="$(cat README.md |grep '^sailfish\s*=' |cut -d '"' -f2)"
NEW_VERSION="${1}"
echo "Bumping version (${OLD_VERSION} => ${NEW_VERSION})"
find . -name Cargo.toml -type f | while read f; do sed -i -e "0,/^version.*/{s/^version.*$/version = \"$NEW_VERSION\"/}" "$f"; done
# bump dependency version
find . -name Cargo.toml -type f | while read f; do sed -i -e "/^path = \"..\/sailfish.*\"/!b;n;cversion = \"$NEW_VERSION\"" "$f"; done
# bump version in README
sed -i -e "s/^\(sailfish.*\) = .*/\1 = \"$NEW_VERSION\"/" README.md
# bump version in documents
find docs/en -path "*.md" -type f |while read f; do sed -i -e "s/^\(sailfish.*\) = .*/\1 = \"$NEW_VERSION\"/" "$f"; done
cargo update -p sailfish --precise "${NEW_VERSION}"