File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,8 +28,41 @@ token=$(printf %s:%s "${centralUsername}" "${centralPassword}" | base64)
2828
2929# Send a POST request to upload the repository:
3030
31- curl --include --request POST \
32- ' https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.github.stephengold' \
31+ server=' ossrh-staging-api.central.sonatype.com'
32+ endpoint=' /manual/upload/defaultRepository/com.github.stephengold'
33+ url=" https://${server}${endpoint} "
34+
35+ statusCode=$( curl " ${url} " \
36+ --no-progress-meter \
37+ --output postData1.txt \
38+ --write-out ' %{response_code}' \
39+ --request POST \
3340 --header ' accept: */*' \
34- --header " Authorization: Bearer $token " \
35- --data ' '
41+ --header " Authorization: Bearer ${token} " \
42+ --data ' ' )
43+
44+ echo " Status code = ${statusCode} "
45+ echo ' Received data:'
46+ cat postData1.txt
47+ echo ' [EOF]'
48+
49+ # Retry if the default repository isn't found (status=400).
50+
51+ if [ " ${statusCode} " == " 400" ]; then
52+ echo " Will retry after 30 seconds."
53+ sleep 30
54+
55+ statusCode2=$( curl " ${url} " \
56+ --no-progress-meter \
57+ --output postData2.txt \
58+ --write-out ' %{response_code}' \
59+ --request POST \
60+ --header ' accept: */*' \
61+ --header " Authorization: Bearer ${token} " \
62+ --data ' ' )
63+
64+ echo " Status code = ${statusCode2} "
65+ echo ' Received data:'
66+ cat postData2.txt
67+ echo ' [EOF]'
68+ fi
You can’t perform that action at this time.
0 commit comments