Created
July 23, 2023 15:12
-
-
Save mdb1/d5b7c005af9989815281dc016cc5d138 to your computer and use it in GitHub Desktop.
An Xcode BuildPhase to enforce a minimum SwiftLint version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ "$(uname -m)" == arm64 ]]; then | |
export PATH="/opt/homebrew/bin:$PATH" | |
fi | |
SWIFTLINT_VERSION=$(swiftlint --version | awk '{print $NF}') | |
MIN_VERSION="0.52.4" | |
# Only run if `installed version` >= `minimum version`. | |
if [[ "$(printf '%s\n' "$MIN_VERSION" "$SWIFTLINT_VERSION" | sort -V | head -n1)" == "$MIN_VERSION" ]]; then | |
echo "SwiftLint version: $SWIFTLINT_VERSION" | |
swiftlint | |
else | |
echo "error: SwiftLint version $MIN_VERSION is required, but you have version $SWIFTLINT_VERSION installed. Run: brew install swiftlint" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment