Skip to content

Commit bed8e58

Browse files
committed
Try to capture the repo ID in the code
1 parent cfb6738 commit bed8e58

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ nexusStaging {
9696
numberOfRetries = 100 // Increase number of retries
9797
delayBetweenRetriesInMillis = 10000 // 10 seconds
9898
}
99+
tasks.publish.doLast {
100+
def stagingPlugin = project.plugins.findPlugin(NexusStagingPlugin)
101+
def stagingManager = stagingPlugin.getStagingManager()
102+
def stagingRepositories = stagingManager.getOpenRepositories()
103+
if (stagingRepositories.size() == 1) {
104+
project.ext.stagingRepositoryId = stagingRepositories[0].repositoryId
105+
} else {
106+
throw new GradleException("Expected exactly one open staging repository, but found ${stagingRepositories.size()}")
107+
}
108+
}
109+
110+
closeAndReleaseRepository {
111+
stagingRepositoryId = project.ext.stagingRepositoryId
112+
}
99113
publishing {
100114

101115
repositories {

publish.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ echo "app.version=$VERSION_SEMVER" >./src/main/resources/com/neuronrobotics/java
1111
./gradlew publish -Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg -Psigning.password=$OSSRH_GPG_SECRET_KEY_PASSWORD -Psigning.keyId=$OSSRH_GPG_SECRET_KEY_ID -PstagingProgressTimeoutMinutes=15
1212

1313
# close and release Sonatype
14-
#./gradlew closeAndReleaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
15-
echo "Closing Repository"
16-
./gradlew closeRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
17-
echo "Releasing repository"
18-
./gradlew releaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
14+
./gradlew closeAndReleaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
15+
#echo "Closing Repository"
16+
#./gradlew closeRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
17+
#echo "Releasing repository"
18+
#./gradlew releaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
1919

0 commit comments

Comments
 (0)