Compare commits
10 Commits
v0.0.7
...
386fded0a3
| Author | SHA1 | Date | |
|---|---|---|---|
| 386fded0a3 | |||
|
|
c6e2e9cc6d | ||
| 88fdc79c82 | |||
|
|
c5466ec373 | ||
| 571ed377a8 | |||
|
|
0cf0458127 | ||
| 6b84af1f16 | |||
|
|
d4233f6c46 | ||
| 4302084b95 | |||
|
|
b15090d558 |
@@ -28,7 +28,7 @@ jobs:
|
||||
echo "Running test suite..."
|
||||
- name: Build project
|
||||
run: |
|
||||
mvn -B -DskipTests clean package source:jar javadoc:jar
|
||||
mvn -B -DskipTests clean verify
|
||||
- name: Deploy to Nexus
|
||||
if: success()
|
||||
run: |
|
||||
@@ -59,15 +59,11 @@ jobs:
|
||||
echo "Missing build artifacts in target"
|
||||
exit 1
|
||||
fi
|
||||
mvn -B deploy:deploy-file \
|
||||
-Dfile="$main_jar" \
|
||||
-Dsources="$sources_jar" \
|
||||
-Djavadoc="$javadoc_jar" \
|
||||
-DpomFile="./pom.xml" \
|
||||
-Durl="https://nexus.imyeyu.com/repository/maven-releases/" \
|
||||
-DrepositoryId="timi-nexus" \
|
||||
mvn -B -DskipTests deploy \
|
||||
-Dhttps.protocols=TLSv1.2 \
|
||||
-Djdk.tls.client.protocols=TLSv1.2
|
||||
-Djdk.tls.client.protocols=TLSv1.2 \
|
||||
-Dmaven.wagon.http.retryHandler.count=3 \
|
||||
-Dmaven.wagon.rto=1800000
|
||||
- name: Create release
|
||||
if: ${{ success() && startsWith(github.event.pull_request.title, 'v') }}
|
||||
env:
|
||||
@@ -92,71 +88,21 @@ 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 -fsS -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"
|
||||
response=$(printf '%s' "$response" | tr -d '\r\n')
|
||||
release_id=$(printf '%s' "$response" | sed -n 's/.*"id":\([0-9][0-9]*\).*/\1/p')
|
||||
if [ -z "$release_id" ] || printf '%s' "$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 -fsS -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"
|
||||
|
||||
26
pom.xml
26
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.imyeyu.network</groupId>
|
||||
<artifactId>timi-network</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@@ -27,6 +27,15 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@@ -64,20 +73,29 @@
|
||||
<charset>UTF-8</charset>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>timi_nexus</id>
|
||||
<id>timi-nexus</id>
|
||||
<url>https://nexus.imyeyu.com/repository/maven-releases/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>timi_nexus</id>
|
||||
<id>timi-nexus</id>
|
||||
<url>https://nexus.imyeyu.com/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
@@ -92,7 +110,7 @@
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.io</groupId>
|
||||
<artifactId>timi-io</artifactId>
|
||||
<version>0.0.2</version>
|
||||
<version>0.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
|
||||
Reference in New Issue
Block a user