Skip to content

Commit

Permalink
Move to gradle-nexus.publish-plugin (#1495)
Browse files Browse the repository at this point in the history
* Migrate to gradle-nexus-publish-plugin

* Don't release (for testing)

* Try to trigger a release

* [wip]

* [wip]

* [wip]

* Use closeSonatypeStagingRepository

* Rename to sonatype

* Move nexusPublishing to root

* Try publishToSonatype

* Revert testing changes
  • Loading branch information
anniel-stripe authored Dec 20, 2022
1 parent 07e30c9 commit 3ce22a7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:

- name: Publish package
run: |
./gradlew publish closeAndRelease -Dorg.gradle.project.NEXUS_USERNAME=$NEXUS_USERNAME -Dorg.gradle.project.NEXUS_PASSWORD=$NEXUS_PASSWORD -Dorg.gradle.project.signing.gnupg.keyName=$GPG_SIGNING_KEYID -Dorg.gradle.project.signing.gnupg.passphrase=$GPG_SIGNING_PASSPHRASE
./gradlew publishToSonatype closeSonatypeStagingRepository -Dorg.gradle.project.NEXUS_USERNAME=$NEXUS_USERNAME -Dorg.gradle.project.NEXUS_PASSWORD=$NEXUS_PASSWORD -Dorg.gradle.project.signing.gnupg.keyName=$GPG_SIGNING_KEYID -Dorg.gradle.project.signing.gnupg.passphrase=$GPG_SIGNING_PASSPHRASE
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
Expand Down
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ buildscript {
//Add only for SNAPSHOT versions
//maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
}
}

plugins {
id "java"
id "maven-publish"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id "signing"
id "jacoco"
id "io.freefair.lombok" version "6.3.0"
Expand Down
26 changes: 17 additions & 9 deletions deploy.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: "io.codearte.nexus-staging"

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
Expand All @@ -32,6 +31,23 @@ def getRepositoryPassword() {
return hasProperty("NEXUS_PASSWORD") ? NEXUS_PASSWORD : ""
}


nexusPublishing {
packageGroup = GROUP

repositories {
sonatype {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}

transitionCheckOptions {
maxRetries.set(40)
delayBetween.set(java.time.Duration.ofMillis(4000))
}
}

afterEvaluate { project ->
tasks.withType(Sign) {
onlyIf { isReleaseBuild() && project.hasProperty("signing.gnupg.keyName") }
Expand All @@ -53,14 +69,6 @@ afterEvaluate { project ->
sign publishing.publications
}

nexusStaging {
packageGroup = GROUP
numberOfRetries = 40
delayBetweenRetriesInMillis = 4000
username = getRepositoryUsername()
password = getRepositoryPassword()
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down

0 comments on commit 3ce22a7

Please sign in to comment.