-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test Install Script | ||
|
||
on: | ||
push: | ||
branches: | ||
- xilosada/test-install-script | ||
pull_request: | ||
branches: | ||
- xilosada/test-install-script | ||
|
||
jobs: | ||
test-install: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
arch: [x86_64, aarch64] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
# Run the installation script | ||
- name: Test installation script | ||
run: | | ||
curl -s https://raw.githubusercontent.com/calimero-network/core/xilosada\/test-install-script/scripts/install.sh | bash | ||
# Validate the binary installation | ||
- name: Validate installation | ||
run: | | ||
which meroctl | ||
meroctl --version |
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,61 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Define version and repository | ||
VERSION="v0.1.1" | ||
REPO="calimero-network/core" | ||
BINARY_NAME="meroctl" | ||
|
||
# Detect OS | ||
OS=$(uname | tr '[:upper:]' '[:lower:]') | ||
|
||
# Detect Architecture | ||
ARCH=$(uname -m) | ||
case "$ARCH" in | ||
"x86_64") ARCH="x86_64" ;; | ||
"arm64" | "aarch64") ARCH="aarch64" ;; | ||
*) | ||
echo "Unsupported architecture: $ARCH." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Determine platform | ||
if [ "$OS" == "darwin" ]; then | ||
PLATFORM="apple-darwin" | ||
elif [ "$OS" == "linux" ]; then | ||
PLATFORM="unknown-linux-gnu" | ||
else | ||
echo "Unsupported operating system: $OS." | ||
exit 1 | ||
fi | ||
|
||
# Construct download URL and tarball name | ||
TARBALL_NAME="${BINARY_NAME}_${ARCH}-${PLATFORM}.tar.gz" | ||
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/$TARBALL_NAME" | ||
|
||
# Download binary tarball | ||
echo "Downloading $TARBALL_NAME from $DOWNLOAD_URL..." | ||
curl -L -o "$TARBALL_NAME" "$DOWNLOAD_URL" | ||
|
||
# Extract tarball | ||
echo "Extracting $TARBALL_NAME..." | ||
tar -xzf "$TARBALL_NAME" | ||
|
||
# Make binary executable | ||
chmod +x "$BINARY_NAME" | ||
|
||
# Move to /usr/local/bin (or another PATH directory) | ||
INSTALL_DIR="/usr/local/bin" | ||
if [ ! -w "$INSTALL_DIR" ]; then | ||
echo "You need sudo permissions to install to $INSTALL_DIR" | ||
sudo mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME" | ||
else | ||
mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME" | ||
fi | ||
|
||
# Clean up tarball | ||
rm "$TARBALL_NAME" | ||
|
||
echo "$BINARY_NAME installed successfully! Run '$BINARY_NAME' to get started." |