Skip to content

Commit

Permalink
Get the second latest
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Jul 8, 2023
1 parent 18c5323 commit 8c0a6bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ increment_version() {
echo "${incremented_version}"
}

# Gets the latest version from the CHANGELOG.md file
# Gets the latest version from the CHANGELOG.md file. Note this assumes the changelog is updated with the
# new version as the latest, so it gets the *2nd* match.
# usage: get_latest_version $changelog_file
get_latest_version() {
local changelog_file=$1
grep -m 1 -o '^[0-9]\+\.[0-9]\+\.[0-9]\+' "$changelog_file"
grep -m 2 -o '^[0-9]\+\.[0-9]\+\.[0-9]\+' "$changelog_file" | tail -n 1
}

# Updates the VERSION_NAME prop in all gradle.properties files to a new value
Expand Down

0 comments on commit 8c0a6bb

Please sign in to comment.