2022-12-29 12:56:54 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-12-24 08:47:34 -05:00
|
|
|
KTLINT_VERSION="$(
|
|
|
|
set -euo pipefail
|
2024-09-27 03:59:31 -04:00
|
|
|
awk -F "[:']" '/ktlint/ {print $4}' "ktlint/build.gradle"
|
2023-12-24 08:47:34 -05:00
|
|
|
)"
|
|
|
|
echo "Installing Ktlint: ${KTLINT_VERSION}"
|
|
|
|
|
2023-12-15 05:59:36 -05:00
|
|
|
url=$(
|
|
|
|
set -euo pipefail
|
|
|
|
curl -s \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
|
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
|
|
|
"https://api.github.com/repos/pinterest/ktlint/releases/tags/${KTLINT_VERSION}" |
|
|
|
|
jq -r '.assets | .[] | select(.name=="ktlint") | .url'
|
|
|
|
)
|
2022-12-29 12:56:54 -05:00
|
|
|
curl --retry 5 --retry-delay 5 -sL -o "/usr/bin/ktlint" \
|
|
|
|
-H "Accept: application/octet-stream" \
|
2023-01-04 00:41:31 -05:00
|
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
2022-12-29 12:56:54 -05:00
|
|
|
"${url}"
|
|
|
|
chmod a+x /usr/bin/ktlint
|