swift -version yields a very human readable version string:
Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-122.214.171.124)
It's a little hard to make sense of in a CI context, though, where shell scripts, rather than Swift code, need to understand the build environment.
Right now I'm parsing it with bash regex like so:
[[ `swift -version` =~ ([0-9]+\.[0-9]+(\.[0-9]+)?) ]]; echo $BASH_REMATCH
But how consistent is the format of this version string? Is there a better way?