Skip to content

Commit 2ec2413

Browse files
committed
fix the curl command to publish to repository
1 parent b6f67aa commit 2ec2413

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/goreleaser.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,23 @@ jobs:
5959
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
6060
- name: Upload to Central Publisher Portal
6161
run: |
62-
curl -X POST \
62+
echo "Uploading to Central Publisher Portal..."
63+
response=$(curl -s -w "%{http_code}" -X POST \
6364
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.github.yoheimuta?publishing_type=automatic" \
64-
-H "Authorization: Bearer ${{ secrets.OSSRH_TOKEN }}" \
65+
-u "${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_TOKEN }}" \
6566
-H "Content-Type: application/json" \
66-
-d '{}'
67+
-d '{}')
68+
69+
http_code="${response: -3}"
70+
response_body="${response%???}"
71+
72+
echo "HTTP Status: $http_code"
73+
echo "Response: $response_body"
74+
75+
if [ "$http_code" -ne 200 ] && [ "$http_code" -ne 201 ] && [ "$http_code" -ne 204 ]; then
76+
echo "Upload failed with HTTP $http_code"
77+
echo "Response: $response_body"
78+
exit 1
79+
else
80+
echo "Upload successful!"
81+
fi

0 commit comments

Comments
 (0)