Skip to content

Commit 2e3a6d0

Browse files
committed
Migrate to Maven Central direct publication
1 parent 8773d66 commit 2e3a6d0

File tree

4 files changed

+37
-73
lines changed

4 files changed

+37
-73
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
run: |
2828
./gradlew build javadoc asciidoc -PfailBuildOnCVSS=4
2929
30-
- name: Upload to bintray
30+
- name: Publish to Maven Central
3131
env:
32-
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
33-
BINTRAY_TOKEN: ${{ secrets.BINTRAY_TOKEN }}
3432
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
3533
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
34+
PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }}
35+
PGP_SIGNING_KEY_PASSPHRASE: ${{ secrets.PGP_SIGNING_KEY_PASSPHRASE }}
3636
run: |
37-
./gradlew bintrayUpload
37+
./gradlew publishStandardPublicationToMavenCentralRepository

.github/workflows/snapshot-release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ jobs:
2727
run: |
2828
./gradlew build -PfailBuildOnCVSS=4
2929
30-
- name: Upload to OSS Snapshot artifactory
30+
- name: Publish to oss.sonatype.org snapshot
3131
env:
32-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
33-
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
32+
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
33+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
34+
PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }}
35+
PGP_SIGNING_KEY_PASSPHRASE: ${{ secrets.PGP_SIGNING_KEY_PASSPHRASE }}
3436
run: |
35-
./gradlew artifactoryPublish
37+
./gradlew publishStandardPublicationToSnapshotRepository

build.gradle

Lines changed: 27 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ allJavaProjects.addAll(sampleAppProjects);
5656
configure(webAuthn4JSpringSecurityLibraryProjects) {
5757
apply plugin: 'java-library'
5858
apply plugin: 'jacoco'
59+
apply plugin: 'signing'
5960
apply plugin: "maven-publish"
60-
apply plugin: 'com.jfrog.bintray'
61-
apply plugin: "com.jfrog.artifactory"
6261

6362
javadoc {
6463
options.charSet = 'UTF-8'
@@ -89,6 +88,10 @@ configure(webAuthn4JSpringSecurityLibraryProjects) {
8988
apply from: "$rootDir/helper.gradle";
9089

9190
def githubUrl = "https://github.com/webauthn4j/webauthn4j-spring-security"
91+
def mavenCentralUser = getVariable('MAVEN_CENTRAL_USER', 'mavenCentralUser')
92+
def mavenCentralPassword = getVariable('MAVEN_CENTRAL_PASSWORD', 'mavenCentralPassword')
93+
def pgpSigningKey = getVariable('PGP_SIGNING_KEY', 'pgpSigningKey')
94+
def pgpSigningKeyPassphrase = getVariable('PGP_SIGNING_KEY_PASSPHRASE', 'pgpSigningKeyPassphrase')
9295

9396
publishing {
9497
publications {
@@ -138,76 +141,36 @@ configure(webAuthn4JSpringSecurityLibraryProjects) {
138141
}
139142
}
140143
}
141-
}
142-
143-
def bintrayUser = getVariable('BINTRAY_USER', 'bintrayUser')
144-
def bintrayToken = getVariable('BINTRAY_TOKEN', 'bintrayToken')
145-
def artifactoryUser = getVariable('ARTIFACTORY_USER', 'artifactoryUser')
146-
def artifactoryPassword = getVariable('ARTIFACTORY_PASSWORD', 'artifactoryPassword')
147-
def mavenCentralUser = getVariable('MAVEN_CENTRAL_USER', 'mavenCentralUser')
148-
def mavenCentralPassword = getVariable('MAVEN_CENTRAL_PASSWORD', 'mavenCentralPassword')
149144

150-
task bintrayGpgSign(){
151-
group = "publishing"
152-
doLast{
153-
signArtifactsOnBintray(bintrayUser, bintrayToken);
154-
}
155-
}
156-
157-
task bintrayMavenCentralSync(){
158-
group = "publishing"
159-
doLast{
160-
syncMavenCentralToBintray(bintrayUser, bintrayToken);
161-
}
162-
}
163-
164-
artifactory {
165-
contextUrl = 'http://oss.jfrog.org/artifactory/simple/'
166-
publish {
167-
repository {
168-
repoKey = 'oss-snapshot-local' // The Artifactory repository key to publish to
169-
username = artifactoryUser
170-
password = artifactoryPassword
145+
repositories {
146+
maven {
147+
name = "mavenCentral"
148+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
149+
credentials {
150+
username = "${mavenCentralUser}"
151+
password = "${mavenCentralPassword}"
152+
}
171153
}
172-
defaults {
173-
publications('standard')
154+
maven {
155+
name = "snapshot"
156+
url = "https://oss.sonatype.org/content/repositories/snapshots"
157+
credentials {
158+
username = "${mavenCentralUser}"
159+
password = "${mavenCentralPassword}"
160+
}
174161
}
175162
}
176163
}
177164

178-
artifactoryPublish {
179-
skip = !"${webAuthn4JSpringSecurityVersion}".endsWith("-SNAPSHOT") // Publish only when it is SNAPSHOT release
165+
signing {
166+
useInMemoryPgpKeys(pgpSigningKey, pgpSigningKeyPassphrase)
167+
sign publishing.publications.standard
180168
}
181169

182-
bintray {
183-
user = bintrayUser
184-
key = bintrayToken
185-
configurations = ['archives']
186-
publish = true
187-
dryRun = !("${webAuthn4JSpringSecurityVersion}".endsWith(".RELEASE")) // Publish only when it is RELEASE release
188-
publications = ['standard']
189-
pkg {
190-
userOrg = "webauthn4j"
191-
repo = "webauthn4j"
192-
name = project.name
193-
desc = project.description
194-
licenses = ['Apache-2.0']
195-
vcsUrl = githubUrl
196-
version {
197-
name = "${webAuthn4JSpringSecurityVersion}"
198-
released = new Date()
199-
vcsTag = "${webAuthn4JSpringSecurityVersion}"
200-
gpg {
201-
sign = true
202-
}
203-
//Optional configuration for Maven Central sync of the version
204-
mavenCentralSync {
205-
user = mavenCentralUser
206-
password = mavenCentralPassword
207-
}
208-
}
209-
}
210-
}
170+
publishStandardPublicationToSnapshotRepository.onlyIf { webauthn4jSpringSecurityVersion.endsWith("-SNAPSHOT") }
171+
publishStandardPublicationToMavenCentralRepository.onlyIf { !webauthn4jSpringSecurityVersion.endsWith("-SNAPSHOT") }
172+
173+
211174
}
212175

213176
configure(sampleAppProjects) {

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
webAuthn4JSpringSecurityVersion=0.7.1-SNAPSHOT
1717
latestReleasedWebAuthn4JSpringSecurityVersion=0.7.0.RELEASE
1818
asciidoctorVersion='1.5.6'
19-

0 commit comments

Comments
 (0)