Skip to content

Instantly share code, notes, and snippets.

@anton-x-t
Last active October 26, 2023 14:28
Show Gist options
  • Save anton-x-t/a5bb770ab18e5f32a4d2877c0e9edbae to your computer and use it in GitHub Desktop.
Save anton-x-t/a5bb770ab18e5f32a4d2877c0e9edbae to your computer and use it in GitHub Desktop.
gradle_properties_bump_minor_version.sh
#!/bin/bash
# Copyright 2023 Anton Thelander
# License: MIT
gradle_properties_file=gradle.properties
original_complete_row=$(grep -E "version=.+\..+\..+" $gradle_properties_file)
before_minor_v=$(echo $original_complete_row | cut -f1 -d".")
original_minor_v=$(echo $original_complete_row | cut -f2 -d".")
after_minor_v=$(echo $original_complete_row | cut -f3 -d".")
bumped_minor_v=$((original_minor_v+1))
bumped_complete_row=$before_minor_v.$bumped_minor_v.$after_minor_v
echo original: $original_complete_row
echo bumped: $bumped_complete_row
sed -i "s/$original_complete_row/$bumped_complete_row/g" "$gradle_properties_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment