diff options
| author | Dax Raad <[email protected]> | 2025-07-18 18:57:58 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-07-18 18:57:58 -0400 |
| commit | c87a7469a006b789e7235e03f453bdd52464d9b4 (patch) | |
| tree | 64e6b9d73f31b92a2133c491c4bdb97b85fe72a4 | |
| parent | 132e26ddbf65bf6555d923f92aa8d76859298917 (diff) | |
| download | opencode-c87a7469a006b789e7235e03f453bdd52464d9b4.tar.gz opencode-c87a7469a006b789e7235e03f453bdd52464d9b4.zip | |
ci: rollback install script
| -rwxr-xr-x | install | 39 |
1 files changed, 13 insertions, 26 deletions
@@ -41,15 +41,20 @@ case "$filename" in ;; esac -# Determine installation directory with priority order -if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then - INSTALL_DIR="$OPENCODE_INSTALL_DIR" -elif [ -n "${XDG_BIN_DIR:-}" ]; then - INSTALL_DIR="$XDG_BIN_DIR" -elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then - INSTALL_DIR="$HOME/bin" +INSTALL_DIR=$HOME/.opencode/bin +mkdir -p "$INSTALL_DIR" + +if [ -z "$requested_version" ]; then + url="https://github.com/sst/opencode/releases/latest/download/$filename" + specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}') + + if [[ $? -ne 0 || -z "$specific_version" ]]; then + echo "${RED}Failed to fetch version information${NC}" + exit 1 + fi else - INSTALL_DIR="$HOME/.opencode/bin" + url="https://github.com/sst/opencode/releases/download/v${requested_version}/$filename" + specific_version=$requested_version fi print_message() { @@ -66,23 +71,6 @@ print_message() { echo -e "${color}${message}${NC}" } -mkdir -p "$INSTALL_DIR" - -print_message info "Installing to: ${YELLOW}$INSTALL_DIR${GREEN}" - -if [ -z "$requested_version" ]; then - url="https://github.com/sst/opencode/releases/latest/download/$filename" - specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}') - - if [[ $? -ne 0 || -z "$specific_version" ]]; then - echo "${RED}Failed to fetch version information${NC}" - exit 1 - fi -else - url="https://github.com/sst/opencode/releases/download/v${requested_version}/$filename" - specific_version=$requested_version -fi - check_version() { if command -v opencode >/dev/null 2>&1; then opencode_path=$(which opencode) @@ -198,4 +186,3 @@ if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then echo "$INSTALL_DIR" >> $GITHUB_PATH print_message info "Added $INSTALL_DIR to \$GITHUB_PATH" fi - |
