This is clearer than the inline shell script previously used, and also more robust.
Unified · Split
| @@ -242,19 +242,16 @@ check-size: · 241 unmodified lines | |||
| 242 | etc/check-package-size.sh | 242 | etc/check-package-size.sh |
| 243 | 243 | ||
| 244 | # Report the Minimum Supported Rust Version (the `rust-version` of `gix`) in X.Y.Z form | 244 | # Report the Minimum Supported Rust Version (the `rust-version` of `gix`) in X.Y.Z form |
| 245 | msrv: | 245 | msrv: (get-metadata ''' |
| 246 | set -eu; \ | 246 | (.packages[] | select(.name == "gix") | .rust_version | tostring) as $v | |
| 247 | query='.packages[] | select(.name == "gix") | .rust_version'; \ | 247 | if ($v | test("^[0-9]+\\.[0-9]+\\.[0-9]+$")) then |
| 248 | value="$({{ j }} get-metadata "$query")"; \ | 248 | $v |
| 249 | case "$value" in \ | 249 | elif ($v | test("^[0-9]+\\.[0-9]+$")) then |
| 250 | *.*.*) \ | 250 | $v + ".0" |
| 251 | echo "$value" ;; \ | 251 | else |
| 252 | *.*) \ | 252 | error("Unrecognized rust-version format: " + $v) |
| 253 | echo "$value.0" ;; \ | 253 | end |
| 254 | *) \ | 254 | ''') |
| 255 | echo "No '.' in gix rust-version '$value'" >&2; \ | ||
| 256 | exit 1 ;; \ | ||
| 257 | esac | ||
| 258 | 255 | ||
| 259 | # Regenerate the MSRV badge SVG | 256 | # Regenerate the MSRV badge SVG |
| 260 | msrv-badge: | 257 | msrv-badge: |