Skip to content

Commit

Permalink
ci: support macos in "install-cometbft" script
Browse files Browse the repository at this point in the history
Flagged by @TalDerei as a nice-to-have during a recent pairing session.
Closes #4264.
  • Loading branch information
conorsch committed Jul 15, 2024
1 parent e13cd3b commit 944e79d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions deployments/scripts/install-cometbft
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ set -euo pipefail
# Sane defaults
COMETBFT_VERSION="${COMETBFT_VERSION:-0.37.5}"

# Determine platform, so we can support both macOS and Linux.
uname_kernel="$(uname -s)"
uname_machine="$(uname -m)"
if [[ "$uname_kernel" = "Linux" && "$uname_machine" = "x86_64" ]] ; then
platform_string="linux_amd64"
elif [[ "$uname_kernel" = "Darwin" && "$uname_machine" = "x86_64" ]] ; then
platform_string="darwin_amd64"
elif [[ "$uname_kernel" = "Darwin" && "$uname_machine" = "arm64" ]] ; then
platform_string="darwin_arm64"
else
>&2 echo "ERROR: platform '$uname_kernel' with architecture '$uname_machine' not supported."
exit 1
fi

# Download and extract
cometbft_download_url="https://github.com/cometbft/cometbft/releases/download/v${COMETBFT_VERSION}/cometbft_${COMETBFT_VERSION}_linux_amd64.tar.gz"
cometbft_download_url="https://github.com/cometbft/cometbft/releases/download/v${COMETBFT_VERSION}/cometbft_${COMETBFT_VERSION}_${platform_string}.tar.gz"
cometbft_temp_dir="$(mktemp -d)"
pushd "$cometbft_temp_dir" > /dev/null
curl -sSfL -O "$cometbft_download_url"
tar -xzf "cometbft_${COMETBFT_VERSION}_linux_amd64.tar.gz" cometbft
tar -xzf "cometbft_${COMETBFT_VERSION}_${platform_string}.tar.gz" cometbft
trap 'rm -r "$cometbft_temp_dir"' EXIT

# Try to write to system-wide location.
Expand Down

0 comments on commit 944e79d

Please sign in to comment.