Skip to content

Instantly share code, notes, and snippets.

@ryanwoodsmall
Created February 19, 2026 05:22
Show Gist options
  • Select an option

  • Save ryanwoodsmall/c6f5a403bd7789e30e4c0068f6914474 to your computer and use it in GitHub Desktop.

Select an option

Save ryanwoodsmall/c6f5a403bd7789e30e4c0068f6914474 to your computer and use it in GitHub Desktop.
jq-get-latest-semver.sh
#!/usr/bin/env bash
#
# given an array of semvers, get the latest. format must follow:
#
# [ "1.2.3", "0.0.1", "1.4.1", ..., "10.11.12" ]
#
# thank you tom
#
jq 'sort_by(split(".")|map(tonumber))|last'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment