Skip to content

Commit

Permalink
Try to capture the repo ID in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jul 25, 2024
1 parent cfb6738 commit bed8e58
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ nexusStaging {
numberOfRetries = 100 // Increase number of retries
delayBetweenRetriesInMillis = 10000 // 10 seconds
}
tasks.publish.doLast {
def stagingPlugin = project.plugins.findPlugin(NexusStagingPlugin)
def stagingManager = stagingPlugin.getStagingManager()
def stagingRepositories = stagingManager.getOpenRepositories()
if (stagingRepositories.size() == 1) {
project.ext.stagingRepositoryId = stagingRepositories[0].repositoryId
} else {
throw new GradleException("Expected exactly one open staging repository, but found ${stagingRepositories.size()}")
}
}

closeAndReleaseRepository {
stagingRepositoryId = project.ext.stagingRepositoryId
}
publishing {

repositories {
Expand Down
10 changes: 5 additions & 5 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ echo "app.version=$VERSION_SEMVER" >./src/main/resources/com/neuronrobotics/java
./gradlew publish -Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg -Psigning.password=$OSSRH_GPG_SECRET_KEY_PASSWORD -Psigning.keyId=$OSSRH_GPG_SECRET_KEY_ID -PstagingProgressTimeoutMinutes=15

# close and release Sonatype
#./gradlew closeAndReleaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
echo "Closing Repository"
./gradlew closeRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
echo "Releasing repository"
./gradlew releaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
./gradlew closeAndReleaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
#echo "Closing Repository"
#./gradlew closeRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD
#echo "Releasing repository"
#./gradlew releaseRepository -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD

0 comments on commit bed8e58

Please sign in to comment.