From d4233f6c46e17a6a1a9e021940de811861e42016 Mon Sep 17 00:00:00 2001 From: Timi Date: Wed, 25 Mar 2026 15:03:58 +0800 Subject: [PATCH] v0.0.8 --- .gitea/workflows/ci.yml | 63 ++++------------------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d017fc0..c964697 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -92,71 +92,20 @@ jobs: } EOF ) - echo "Creating release with tag: $RELEASE_TAG" - echo "API URL: $api_url" - echo "Target commit: $RELEASE_TARGET" - - http_code=$(curl -sS -w "%{http_code}" -o /tmp/release_response.json -X POST "$api_url" \ + response=$(curl -sS -X POST "$api_url" \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "$payload") - - response=$(cat /tmp/release_response.json) - echo "HTTP Status: $http_code" - echo "Response: $response" - - if [ "$http_code" -ne 201 ]; then - echo "Failed to create release (HTTP $http_code)" - if echo "$response" | grep -q "already exists"; then - echo "Release with tag $RELEASE_TAG already exists" - fi - exit 1 - fi - - release_id=$(echo "$response" | grep -oP '"id":\K[0-9]+' | head -n 1 || true) - if [ -z "$release_id" ]; then - echo "Failed to extract release ID from response" + release_id=$(echo "$response" | grep -o '"id":[0-9]*' | head -n 1 | grep -o '[0-9]*') + if [ -z "$release_id" ] || echo "$response" | grep -q '"message"'; then + echo "Create release failed: $response" exit 1 fi echo "Release created: id=$release_id" - - echo "Listing jar files in target directory:" - ls -lh target/*.jar || echo "No jar files found" - - upload_count=0 for asset_path in target/*.jar; do - if [ ! -f "$asset_path" ]; then - echo "Skipping non-existent file: $asset_path" - continue - fi asset_name=$(basename "$asset_path") - file_size=$(stat -c%s "$asset_path" 2>/dev/null || echo "unknown") - echo "Uploading asset: $asset_name (size: $file_size bytes)" - - upload_url="$api_url/$release_id/assets?name=$asset_name" - echo "Upload URL: $upload_url" - - set +e - http_code=$(curl -sS -w "%{http_code}" -o /tmp/asset_response.json -X POST "$upload_url" \ + curl -sS -X POST "$api_url/$release_id/assets?name=$asset_name" \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/octet-stream" \ - --data-binary @"$asset_path" 2>/dev/null) - curl_exit=$? - set -e - - if [ $curl_exit -ne 0 ]; then - echo "✗ Curl failed with exit code $curl_exit for $asset_name" - cat /tmp/asset_response.json 2>/dev/null || echo "No response file" - continue - fi - - if [ "$http_code" = "201" ]; then - echo "✓ Successfully uploaded: $asset_name" - upload_count=$((upload_count + 1)) - else - echo "✗ Failed to upload $asset_name (HTTP $http_code)" - cat /tmp/asset_response.json 2>/dev/null || echo "No response body" - fi + --data-binary @"$asset_path" done - - echo "Upload complete: $upload_count file(s) uploaded" -- 2.49.1