Ver Fonte

ci: rollback install script

Dax Raad há 7 meses atrás
pai
commit
c87a7469a0
1 ficheiros alterados com 13 adições e 26 exclusões
  1. 13 26
      install

+ 13 - 26
install

@@ -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
-