Skip to content

Commit c18e521

Browse files
Portal Publisher API auth with Bearer
1 parent 3ee9656 commit c18e521

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.github/workflows/publishing2sonatype.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636
sed -i -e 's|.*sonatypePassword.*| password = "${{ secrets.SPASSWORD }}"|' ./build.gradle
3737
- name: Sonatype Publish
3838
run: |
39-
./gradlew -S publishJarPublicationToStagingRepository
4039
BEARER=$(printf "${{ secrets.SUSER }}:${{ secrets.SPASSWORD }}" | base64)
41-
curl --request POST \
42-
--verbose \
43-
--header "Authorization: Bearer ${BEARER}" \
44-
https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${{ secrets.SREPO_ID }}
40+
echo "stagingAuthHeaderName=Authorization" >> ./gradle.properties
41+
echo "stagingAuthHeaderValuee=Bearer ${BEARER}" >> ./gradle.properties
42+
./gradlew -S publishJarPublicationToStagingRepository
43+
# curl --request POST \
44+
# --verbose \
45+
# --header "Authorization: Bearer ${BEARER}" \
46+
# https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${{ secrets.SREPO_ID }}

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ publishing {
160160
name 'staging'
161161
url = 'https://central.sonatype.com/api/v1/publisher/deployments/download/'
162162

163-
credentials {
164-
username = "${sonatypeUsername}"
165-
password = "${sonatypePassword}"
163+
credentials(HttpHeaderCredentials)
164+
authentication {
165+
header(HttpHeaderAuthentication)
166166
}
167+
167168
}
168169
}
169170
}

0 commit comments

Comments
 (0)