feat(install-scripts): Updated installation scripts to fetch the latest version from GitHub and fixed download links.

Updated client and server installation scripts to automatically fetch the latest release via the GitHub API and corrected binary download addresses. Removed the old "latest" version logic to ensure explicit version tags are always used for downloads.

fix(readme): Fixed installation commands and license information in the README.

Corrected the installation script link pointing to an incorrect URL in the README to the correct path raw.githubusercontent.com, and updated the open-source license information used by the project from MIT to BSD 3-Clause.

ci(release): Added an automated GitHub Actions release workflow.

Added a new CI workflow configuration file to trigger the build process when a tag is pushed. This workflow compiles binaries for multiple platforms, generates checksums, and creates a GitHub Release with attachments. Supports different architectures including Linux, macOS, and Windows.
This commit is contained in:
Gouryella
2025-12-02 16:40:53 +08:00
parent 090efcc64c
commit e0e33c3323
6 changed files with 130 additions and 58 deletions

View File

@@ -4,12 +4,12 @@ set -e
# ============================================================================
# Configuration
# ============================================================================
DOWNLOAD_BASE_URL="https://"
GITHUB_REPO="Gouryella/drip"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
SERVICE_USER="${SERVICE_USER:-drip}"
CONFIG_DIR="/etc/drip"
WORK_DIR="/var/lib/drip"
VERSION="${VERSION:-latest}"
VERSION="${VERSION:-}"
# Default values
DEFAULT_PORT=8443
@@ -348,24 +348,26 @@ check_dependencies() {
print_success "$(msg deps_ok)"
}
get_remote_version() {
# Download binary to temp location to check version
local binary_name="drip-linux-${ARCH}"
local download_url="${DOWNLOAD_BASE_URL}/${VERSION}/${binary_name}"
local tmp_file="/tmp/drip-check-$$"
get_latest_version() {
# Get latest version from GitHub API
local api_url="https://api.github.com/repos/${GITHUB_REPO}/releases/latest"
local version=""
if command -v curl &> /dev/null; then
curl -fsSL "$download_url" -o "$tmp_file" 2>/dev/null || return 1
version=$(curl -fsSL "$api_url" | grep '"tag_name":' | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/' 2>/dev/null)
else
wget -q "$download_url" -O "$tmp_file" 2>/dev/null || return 1
version=$(wget -qO- "$api_url" | grep '"tag_name":' | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/' 2>/dev/null)
fi
chmod +x "$tmp_file"
local remote_version=$("$tmp_file" version 2>/dev/null | awk '/Version:/ {print $2}' || echo "unknown")
rm -f "$tmp_file"
echo "$remote_version"
if [[ -z "$version" ]]; then
print_error "Failed to get latest version from GitHub"
exit 1
fi
echo "$version"
}
check_existing_install() {
local server_path="$INSTALL_DIR/drip"
@@ -377,17 +379,13 @@ check_existing_install() {
# Check remote version
print_step "Checking for updates..."
local remote_version=$(get_remote_version)
local latest_version=$(get_latest_version)
if [[ "$remote_version" == "unknown" ]]; then
print_warning "Could not check remote version"
echo ""
read -p "$(msg update_now) [Y/n]: " update_choice < /dev/tty
elif [[ "$current_version" == "$remote_version" ]]; then
if [[ "$current_version" == "$latest_version" ]]; then
print_success "Already up to date ($current_version)"
exit 0
else
print_info "Latest version: $remote_version"
print_info "Latest version: $latest_version"
echo ""
read -p "$(msg update_now) [Y/n]: " update_choice < /dev/tty
fi
@@ -411,14 +409,19 @@ check_existing_install() {
# Download and install
# ============================================================================
download_binary() {
# Get latest version if not set
if [[ -z "$VERSION" ]]; then
VERSION=$(get_latest_version)
fi
if [[ "$IS_UPDATE" == true ]]; then
print_step "$(msg updating)"
else
print_step "$(msg downloading)..."
fi
local binary_name="drip-linux-${ARCH}"
local download_url="${DOWNLOAD_BASE_URL}/${VERSION}/${binary_name}"
local binary_name="drip-${VERSION}-linux-${ARCH}"
local download_url="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${binary_name}"
local tmp_file="/tmp/drip"