Skip to content

Commit 52a539b

Browse files
committed
Add script to bump version in Cargo.toml files
1 parent e535682 commit 52a539b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

versions.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
FILES=(`find . -name Cargo.toml`)
4+
5+
if [ -z "$1" ]; then
6+
echo "No version specified! e.g.: ./versions.sh 0.0.2"
7+
exit 1
8+
fi
9+
VERSION=$1
10+
version_prefix="version = "
11+
12+
echo "Settting version to: '$VERSION'"
13+
for file in "${FILES[@]}"
14+
do
15+
# This version is handled manually
16+
if [ "$file" = "./mina-p2p-messages/Cargo.toml" ]; then
17+
continue
18+
fi
19+
old_version=`cat $file | grep ^"$version_prefix"`
20+
if [ -z "$old_version" ]; then
21+
continue
22+
fi
23+
24+
new_version="version = \"$VERSION\""
25+
26+
version_before="${old_version/#$version_prefix}"
27+
# replace version
28+
sed -i "s/$old_version/$new_version/g" $file
29+
version_after=`cat $file | grep ^version | tr --delete "$version_prefix"`
30+
31+
echo "$file $version_before -> $version_after"
32+
done

0 commit comments

Comments
 (0)