-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: install script #626
Merged
technicallyty
merged 6 commits into
main
from
tyler/blo-1525-curl-command-for-installing-connect
Jul 25, 2024
Merged
feat: install script #626
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c052c2c
install script
technicallyty 7c2a802
update docs
technicallyty c6b264a
remove that
technicallyty 43bbd99
attempt to fix codecov
technicallyty 9b3c91e
try this
technicallyty b63939e
Merge branch 'main' into tyler/blo-1525-curl-command-for-installing-c…
technicallyty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
ignore: | ||
- ".github/**/*" | ||
- "**/*.sh" | ||
- "**/*.mdx" | ||
- "**/*.pulsar.go" | ||
- "**/*.pb.go" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
SLINKY_RELEASES_URL="https://api.github.com/repos/skip-mev/slinky/releases/latest" | ||
|
||
# Determine the system architecture | ||
ARCH=$(uname -m) | ||
OS=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
|
||
# Fetch the latest release information | ||
echo "Fetching latest release information..." | ||
RELEASE_INFO=$(curl -s ${SLINKY_RELEASES_URL}) | ||
VERSION=$(echo ${RELEASE_INFO} | grep -o '"tag_name": "v[^"]*' | cut -d'"' -f4) | ||
VERSION=${VERSION#v} # Remove the 'v' prefix | ||
|
||
# Map architecture to release file name | ||
case "${ARCH}" in | ||
x86_64) | ||
if [ "${OS}" = "darwin" ]; then | ||
FILE_NAME="slinky-${VERSION}-darwin-amd64.tar.gz" | ||
else | ||
FILE_NAME="slinky-${VERSION}-linux-amd64.tar.gz" | ||
fi | ||
;; | ||
aarch64|arm64) | ||
if [ "${OS}" = "darwin" ]; then | ||
FILE_NAME="slinky-${VERSION}-darwin-arm64.tar.gz" | ||
else | ||
FILE_NAME="slinky-${VERSION}-linux-arm64.tar.gz" | ||
fi | ||
;; | ||
i386|i686) | ||
FILE_NAME="slinky-${VERSION}-linux-386.tar.gz" | ||
;; | ||
*) | ||
echo "Unsupported architecture: ${ARCH}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Get download URL for the specific file | ||
DOWNLOAD_URL=$(echo ${RELEASE_INFO} | grep -o "\"browser_download_url\": \"[^\"]*${FILE_NAME}\"" | cut -d'"' -f4) | ||
|
||
if [ -z "${DOWNLOAD_URL}" ]; then | ||
echo "Failed to find download URL for ${FILE_NAME}" | ||
exit 1 | ||
fi | ||
|
||
# Download the release | ||
echo "Downloading ${FILE_NAME}..." | ||
curl -LO "${DOWNLOAD_URL}" | ||
|
||
# Create a temporary directory for extraction | ||
TEMP_DIR=$(mktemp -d) | ||
echo "Extracting slinky binary to ${TEMP_DIR}..." | ||
tar -xzf "${FILE_NAME}" -C "${TEMP_DIR}" | ||
|
||
# Find the slinky binary | ||
SLINKY_BIN=$(find "${TEMP_DIR}" -type f -name "slinky") | ||
|
||
if [ -z "${SLINKY_BIN}" ]; then | ||
echo "Failed to find slinky binary in the extracted files" | ||
rm -rf "${TEMP_DIR}" | ||
rm "${FILE_NAME}" | ||
exit 1 | ||
fi | ||
|
||
# Move the binary to /usr/local/bin | ||
echo "Installing slinky to /usr/local/bin..." | ||
sudo mv "${SLINKY_BIN}" /usr/local/bin/ | ||
|
||
# Make it executable | ||
sudo chmod +x /usr/local/bin/slinky | ||
|
||
# Clean up | ||
rm -rf "${TEMP_DIR}" | ||
rm "${FILE_NAME}" | ||
|
||
echo "Slinky ${VERSION} has been installed successfully!" | ||
This file contains 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
This file contains 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could have another output that is just like
run slinky --help for more info
but not big deal really