Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 01074e1ac2 | |||
| 1b60210c06 | |||
| 2290ac5ecf | |||
| 6101e8d462 | |||
| aaea3a218b |
@@ -92,20 +92,71 @@ jobs:
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
response=$(curl -sS -X POST "$api_url" \
|
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" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$payload")
|
-d "$payload")
|
||||||
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
|
response=$(cat /tmp/release_response.json)
|
||||||
echo "Create release failed: $response"
|
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"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Release created: id=$release_id"
|
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
|
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")
|
asset_name=$(basename "$asset_path")
|
||||||
curl -sS -X POST "$api_url/$release_id/assets?name=$asset_name" \
|
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" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary @"$asset_path"
|
--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
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Upload complete: $upload_count file(s) uploaded"
|
||||||
|
|||||||
8
pom.xml
8
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.network</groupId>
|
<groupId>com.imyeyu.network</groupId>
|
||||||
<artifactId>timi-network</artifactId>
|
<artifactId>timi-network</artifactId>
|
||||||
<version>0.0.8</version>
|
<version>0.0.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.imyeyu.io</groupId>
|
<groupId>com.imyeyu.io</groupId>
|
||||||
<artifactId>timi-io</artifactId>
|
<artifactId>timi-io</artifactId>
|
||||||
<version>0.0.3</version>
|
<version>0.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
@@ -100,9 +100,9 @@
|
|||||||
<version>5.6</version>
|
<version>5.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>tools.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>2.21.1</version>
|
<version>3.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
package com.imyeyu.network;
|
package com.imyeyu.network;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import com.fasterxml.jackson.core.JacksonException;
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
||||||
import org.apache.hc.client5.http.fluent.Request;
|
import org.apache.hc.client5.http.fluent.Request;
|
||||||
import org.apache.hc.core5.http.ContentType;
|
import org.apache.hc.core5.http.ContentType;
|
||||||
import org.apache.hc.core5.http.HttpEntity;
|
import org.apache.hc.core5.http.HttpEntity;
|
||||||
|
import tools.jackson.core.JacksonException;
|
||||||
|
import tools.jackson.core.type.TypeReference;
|
||||||
|
import tools.jackson.databind.JsonNode;
|
||||||
|
import tools.jackson.databind.ObjectMapper;
|
||||||
|
import tools.jackson.databind.node.ArrayNode;
|
||||||
|
import tools.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基于 Jackson 的请求封装。
|
* 基于 Jackson 的请求封装。
|
||||||
@@ -26,12 +23,6 @@ public class JacksonRequest extends CommonRequest {
|
|||||||
|
|
||||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
static {
|
|
||||||
OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
OBJECT_MAPPER.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = null;
|
private ObjectMapper objectMapper = null;
|
||||||
|
|
||||||
protected JacksonRequest(Request request) {
|
protected JacksonRequest(Request request) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.imyeyu.network;
|
package com.imyeyu.network;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.JavaType;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiResponse;
|
import com.imyeyu.java.bean.timi.TimiResponse;
|
||||||
import org.apache.hc.client5.http.fluent.Request;
|
import org.apache.hc.client5.http.fluent.Request;
|
||||||
import org.apache.hc.core5.http.HttpEntity;
|
import org.apache.hc.core5.http.HttpEntity;
|
||||||
|
import tools.jackson.core.type.TypeReference;
|
||||||
|
import tools.jackson.databind.JavaType;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|||||||
Reference in New Issue
Block a user