From a587a3c0ee3f02ad71656c74d8194c75332e9478 Mon Sep 17 00:00:00 2001 From: ytimocin Date: Fri, 3 Jan 2025 16:58:45 -0800 Subject: [PATCH] Initial work on adding the install.sh script This will be used by the users of Prompt-Ops to download the pops binary Signed-off-by: ytimocin --- .github/scripts/install.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/scripts/install.sh diff --git a/.github/scripts/install.sh b/.github/scripts/install.sh new file mode 100644 index 0000000..42d55a0 --- /dev/null +++ b/.github/scripts/install.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +# Get the latest release version if not provided +VERSION=${1:-$(curl -s https://api.github.com/repos/prompt-ops/pops/releases/latest | grep tag_name | cut -d '"' -f 4)} + +# Detect OS and ARCH +OS=$(uname | tr '[:upper:]' '[:lower:]') +ARCH=$(uname -m) + +if [[ "$ARCH" == "x86_64" ]]; then + ARCH="amd64" +elif [[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]]; then + ARCH="arm64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + +# Construct download URL +URL="https://github.com/prompt-ops/pops/releases/download/$VERSION/pops-${OS}-${ARCH}" + +echo "Downloading pops $VERSION from $URL..." +curl -Lo pops "$URL" +chmod +x pops + +# Move to /usr/local/bin +echo "Installing pops to /usr/local/bin..." +sudo mv pops /usr/local/bin/ + +echo "pops $VERSION installed successfully!"