Skip to content

Commit

Permalink
Add validtion for version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Feb 8, 2023
1 parent 5879e34 commit 51ba8e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,20 @@ esac
echo "$v => $v2"

for f in $VERSIONED_FILES; do \
prevCount=$(grep -c -i "$v2" "$f")

# Replace the version.
echo "- $f"; \
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/$v/$v2/g" "$f"; \
else
sed -i "s/$v/$v2/g" "$f"; \
fi

# Check if the version has being properly replaced.
newCount=$(grep -c -i "$v2" "$f")
if [[ $newCount -le $prevCount ]]; then
echo "fail to update version in '$f'"
exit 1
fi
done

0 comments on commit 51ba8e2

Please sign in to comment.