Skip to content

Commit 1b41440

Browse files
Adjusts Sonatype Publishing (#143)
1 parent e2eccce commit 1b41440

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed

.github/workflows/publishing2sonatype.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
run: |
3434
sed -i -e 's|.*sonatypeUsername.*| username = "${{ secrets.SUSER }}"|' ./build.gradle
3535
sed -i -e 's|.*sonatypePassword.*| password = "${{ secrets.SPASSWORD }}"|' ./build.gradle
36-
- name: Publish to Sonatype
36+
- name: Sonatype Publish
3737
run: |
38-
./gradlew publishJarPublicationToStagingRepository
38+
./gradlew publishJarPublicationToStagingRepository
39+
BEARER=$(printf "${{ secrets.SUSER }}:${{ secrets.SPASSWORD }}" | base64)
40+
curl --request POST \
41+
--verbose \
42+
--header "Authorization: Bearer ${BEARER}" \
43+
https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${{ secrets.SREPO_ID }}

build.gradle

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ def pomConfig = {
7474
inceptionYear 2016
7575
organization {
7676
name 'Sift Science'
77-
url 'https://siftscience.com'
77+
url 'https://sift.com'
7878
}
7979
developers {
8080
developer {
81-
id 'lopatin'
82-
name 'Alex Lopatin'
83-
url 'https://github.com/lopatin'
81+
id 'sift-api-platform'
82+
name 'Sift API Platform Team'
8483
}
8584
}
8685
scm {
@@ -121,37 +120,6 @@ publishing {
121120
last.parent().appendNode('description', 'Sift Science Java API')
122121
last + pomConfig
123122
}
124-
125-
// Sign the pom.xml.
126-
pom.withXml {
127-
def pomFile = file("${project.buildDir}/generated-pom.xml")
128-
writeTo(pomFile)
129-
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
130-
artifact(pomAscFile) {
131-
classifier = null
132-
extension = 'pom.asc'
133-
}
134-
pomFile.delete()
135-
}
136-
137-
// Sign the artifacts.
138-
project.tasks.signArchives.signatureFiles.each {
139-
artifact(it) {
140-
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
141-
def zipMatcher = it.file =~ /\.(zip|tar)\.asc$/
142-
def extensionPrefix = 'jar'
143-
if (zipMatcher.find()) {
144-
extensionPrefix = zipMatcher.group(1)
145-
}
146-
if (matcher.find()) {
147-
classifier = matcher.group(1)
148-
} else {
149-
classifier = null
150-
}
151-
152-
extension = extensionPrefix + '.asc'
153-
}
154-
}
155123
}
156124
}
157125

@@ -168,10 +136,9 @@ publishing {
168136
}
169137
}
170138

171-
model {
172-
tasks.publishJarPublicationToStagingRepository {
173-
dependsOn(project.tasks.signArchives)
174-
}
139+
signing {
140+
required { gradle.taskGraph.hasTask("publish") }
141+
sign publishing.publications.jar
175142
}
176143

177144
distributions {

0 commit comments

Comments
 (0)