1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash if [ "$1" == "" ]; then echo "Usage: version.sh X.Y.Z" exit 1 fi current_version="$(cargo read-manifest | sed 's/.*"version":"\([^"]\+\)".*/\1/g')" current_short_version="$(echo "$current_version" | sed 's/\([^.]\+\.[^.]\+\)\..*/\1/g')" new_short_version="$(echo "$1" | sed 's/\([^.]\+\.[^.]\+\)\..*/\1/g')" echo "updating from $current_version to $1" sed -i 's/version = "'$current_version'" #automatically updated/version = "'$1'" #automatically updated/' Cargo.toml sed -i 's/rustful = "'$current_short_version'"/rustful = "'$new_short_version'"/' README.md bash scripts/changelog.sh