diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0091d72..c964697 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: echo "Running test suite..." - name: Build project run: | - mvn -B -DskipTests clean verify + mvn -B -DskipTests clean package source:jar javadoc:jar - name: Deploy to Nexus if: success() run: | @@ -59,11 +59,15 @@ jobs: echo "Missing build artifacts in target" exit 1 fi - mvn -B -DskipTests deploy \ + 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" \ -Dhttps.protocols=TLSv1.2 \ - -Djdk.tls.client.protocols=TLSv1.2 \ - -Dmaven.wagon.http.retryHandler.count=3 \ - -Dmaven.wagon.rto=1800000 + -Djdk.tls.client.protocols=TLSv1.2 - name: Create release if: ${{ success() && startsWith(github.event.pull_request.title, 'v') }} env: @@ -88,20 +92,19 @@ jobs: } EOF ) - response=$(curl -fsS -X POST "$api_url" \ + response=$(curl -sS -X POST "$api_url" \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "$payload") - 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 + 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" for asset_path in target/*.jar; do asset_name=$(basename "$asset_path") - curl -fsS -X POST "$api_url/$release_id/assets?name=$asset_name" \ + 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" diff --git a/pom.xml b/pom.xml index cfb4b8a..5a2dd56 100644 --- a/pom.xml +++ b/pom.xml @@ -27,15 +27,6 @@ org.apache.maven.plugins maven-source-plugin 3.3.1 - - - attach-sources - package - - jar - - - org.projectlombok @@ -73,29 +64,20 @@ UTF-8 UTF-8 - - - attach-javadocs - package - - jar - - - - timi-nexus + timi_nexus https://nexus.imyeyu.com/repository/maven-releases/ - timi-nexus + timi_nexus https://nexus.imyeyu.com/repository/maven-public/ true