v7.0.0 - Version 1.0.0

This commit is contained in:
Your Name
2025-11-01 06:56:02 -04:00
parent f6330e4bb8
commit ee4208cc19
2 changed files with 46 additions and 23 deletions

BIN
c-relay-7.0.0.tar.gz Normal file

Binary file not shown.

View File

@@ -8,10 +8,10 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m' BLUE='\033[0;34m'
NC='\033[0m' NC='\033[0m'
print_status() { echo -e "${BLUE}[INFO]${NC} $1"; } print_status() { echo -e "${BLUE}[INFO]${NC} $1" >&2; }
print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; } print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" >&2; }
print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; } print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" >&2; }
print_error() { echo -e "${RED}[ERROR]${NC} $1"; } print_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
# Global variables # Global variables
COMMIT_MESSAGE="" COMMIT_MESSAGE=""
@@ -366,23 +366,38 @@ upload_release_assets() {
local token=$(cat "$HOME/.gitea_token" | tr -d '\n\r') local token=$(cat "$HOME/.gitea_token" | tr -d '\n\r')
local api_url="https://git.laantungir.net/api/v1/repos/laantungir/c-relay" local api_url="https://git.laantungir.net/api/v1/repos/laantungir/c-relay"
local assets_url="$api_url/releases/$release_id/assets"
print_status "Assets URL: $assets_url"
# Upload binary # Upload binary
if [[ -f "$binary_path" ]]; then if [[ -f "$binary_path" ]]; then
print_status "Uploading binary: $(basename "$binary_path")" print_status "Uploading binary: $(basename "$binary_path")"
print_status "Debug: API URL: $api_url/releases/$release_id/assets"
print_status "Debug: Binary path: $binary_path"
print_status "Debug: Binary exists: $(ls -la "$binary_path" 2>/dev/null || echo "NOT FOUND")"
local binary_response=$(curl -v -X POST "$api_url/releases/$release_id/assets" \
-H "Authorization: token $token" \
-F "attachment=@$binary_path;filename=$(basename "$binary_path")" 2>&1)
if echo "$binary_response" | grep -q '"id"'; then # Retry loop for eventual consistency
print_success "Uploaded binary successfully" local max_attempts=3
else local attempt=1
print_warning "Failed to upload binary" while [[ $attempt -le $max_attempts ]]; do
print_warning "Response: $binary_response" print_status "Upload attempt $attempt/$max_attempts"
fi local binary_response=$(curl -fS -X POST "$assets_url" \
-H "Authorization: token $token" \
-F "attachment=@$binary_path;filename=$(basename "$binary_path")" \
-F "name=$(basename "$binary_path")")
if echo "$binary_response" | grep -q '"id"'; then
print_success "Uploaded binary successfully"
break
else
print_warning "Upload attempt $attempt failed"
if [[ $attempt -lt $max_attempts ]]; then
print_status "Retrying in 2 seconds..."
sleep 2
else
print_error "Failed to upload binary after $max_attempts attempts"
print_error "Response: $binary_response"
fi
fi
((attempt++))
done
fi fi
# Upload source tarball # Upload source tarball
@@ -434,8 +449,10 @@ create_gitea_release() {
local release_id=$(echo "$check_response" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) local release_id=$(echo "$check_response" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
print_status "Using existing release ID: $release_id" print_status "Using existing release ID: $release_id"
echo $release_id echo $release_id
else
print_error "Could not find existing release ID"
return 1
fi fi
echo 0
else else
print_error "Failed to create release $NEW_VERSION" print_error "Failed to create release $NEW_VERSION"
print_error "Response: $response" print_error "Response: $response"
@@ -449,7 +466,7 @@ create_gitea_release() {
echo $release_id echo $release_id
else else
print_error "Release does not exist and creation failed" print_error "Release does not exist and creation failed"
echo 1 return 1
fi fi
fi fi
} }
@@ -510,12 +527,18 @@ main() {
# Create Gitea release # Create Gitea release
local release_id="" local release_id=""
if release_id=$(create_gitea_release 2>&1); then if release_id=$(create_gitea_release); then
# Upload assets if we have a release ID and assets # Validate release_id is numeric
if [[ -n "$release_id" && (-n "$binary_path" || -n "$tarball_path") ]]; then if [[ "$release_id" =~ ^[0-9]+$ ]]; then
upload_release_assets "$release_id" "$binary_path" "$tarball_path" # Upload assets if we have a release ID and assets
if [[ -n "$release_id" && (-n "$binary_path" || -n "$tarball_path") ]]; then
upload_release_assets "$release_id" "$binary_path" "$tarball_path"
fi
print_success "Release $NEW_VERSION completed successfully!"
else
print_error "Invalid release_id: $release_id"
exit 1
fi fi
print_success "Release $NEW_VERSION completed successfully!"
else else
print_error "Release creation failed" print_error "Release creation failed"
fi fi