Compare commits
8 Commits
v0.0.7
...
88fdc79c82
| Author | SHA1 | Date | |
|---|---|---|---|
| 88fdc79c82 | |||
|
|
c5466ec373 | ||
| 571ed377a8 | |||
|
|
0cf0458127 | ||
| 6b84af1f16 | |||
|
|
d4233f6c46 | ||
| 4302084b95 | |||
|
|
b15090d558 |
@@ -28,7 +28,7 @@ jobs:
|
|||||||
echo "Running test suite..."
|
echo "Running test suite..."
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: |
|
run: |
|
||||||
mvn -B -DskipTests clean package source:jar javadoc:jar
|
mvn -B -DskipTests clean verify
|
||||||
- name: Deploy to Nexus
|
- name: Deploy to Nexus
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
@@ -59,15 +59,11 @@ jobs:
|
|||||||
echo "Missing build artifacts in target"
|
echo "Missing build artifacts in target"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
mvn -B deploy:deploy-file \
|
mvn -B -DskipTests deploy \
|
||||||
-Dfile="$main_jar" \
|
|
||||||
-Dsources="$sources_jar" \
|
|
||||||
-Djavadoc="$javadoc_jar" \
|
|
||||||
-DpomFile="./pom.xml" \
|
|
||||||
-Durl="https://nexus.imyeyu.com/repository/maven-releases/" \
|
|
||||||
-DrepositoryId="timi-nexus" \
|
|
||||||
-Dhttps.protocols=TLSv1.2 \
|
-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
|
- name: Create release
|
||||||
if: ${{ success() && startsWith(github.event.pull_request.title, 'v') }}
|
if: ${{ success() && startsWith(github.event.pull_request.title, 'v') }}
|
||||||
env:
|
env:
|
||||||
@@ -92,71 +88,20 @@ jobs:
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
echo "Creating release with tag: $RELEASE_TAG"
|
response=$(curl -sS -X POST "$api_url" \
|
||||||
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]*')
|
||||||
response=$(cat /tmp/release_response.json)
|
if [ -z "$release_id" ] || echo "$response" | grep -q '"message"'; then
|
||||||
echo "HTTP Status: $http_code"
|
echo "Create release failed: $response"
|
||||||
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")
|
||||||
file_size=$(stat -c%s "$asset_path" 2>/dev/null || echo "unknown")
|
curl -sS -X POST "$api_url/$release_id/assets?name=$asset_name" \
|
||||||
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" 2>/dev/null)
|
--data-binary @"$asset_path"
|
||||||
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"
|
|
||||||
|
|||||||
26
pom.xml
26
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.7</version>
|
<version>0.0.8</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -27,6 +27,15 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>3.3.1</version>
|
<version>3.3.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
@@ -64,20 +73,29 @@
|
|||||||
<charset>UTF-8</charset>
|
<charset>UTF-8</charset>
|
||||||
<docencoding>UTF-8</docencoding>
|
<docencoding>UTF-8</docencoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>timi_nexus</id>
|
<id>timi-nexus</id>
|
||||||
<url>https://nexus.imyeyu.com/repository/maven-releases/</url>
|
<url>https://nexus.imyeyu.com/repository/maven-releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>timi_nexus</id>
|
<id>timi-nexus</id>
|
||||||
<url>https://nexus.imyeyu.com/repository/maven-public/</url>
|
<url>https://nexus.imyeyu.com/repository/maven-public/</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
@@ -92,7 +110,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.imyeyu.io</groupId>
|
<groupId>com.imyeyu.io</groupId>
|
||||||
<artifactId>timi-io</artifactId>
|
<artifactId>timi-io</artifactId>
|
||||||
<version>0.0.2</version>
|
<version>0.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user