Skip to content

Commit

Permalink
WOrking with changes to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jul 25, 2024
1 parent bed8e58 commit 28f45cf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 33 deletions.
71 changes: 41 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,53 @@ plugins {
id 'io.codearte.nexus-staging' version '0.30.0'
}

File buildDir = file(".");
Properties props = new Properties()
props.load(new FileInputStream(buildDir.getAbsolutePath()+"/src/main/resources/com/neuronrobotics/javacad/build.properties"))
group = "com.neuronrobotics"
archivesBaseName = "JavaCad"
version = props."app.version"

// BEGIN AI SLOP

nexusStaging {
serverUrl = "https://oss.sonatype.org/service/local/"
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
packageGroup = "com.neuronrobotics" // Replace with your actual package group
}

task closeAndReleaseSeparately {
dependsOn tasks.releaseRepository
}

tasks.releaseRepository.dependsOn tasks.closeRepository
tasks.closeRepository.dependsOn tasks.getStagingProfile

// Optional: Add this if you want to see more information during the execution
tasks.getStagingProfile.logging.level = LogLevel.INFO
tasks.closeRepository.logging.level = LogLevel.INFO
tasks.releaseRepository.logging.level = LogLevel.INFO

tasks.getStagingProfile.doFirst {
println "Executing getStagingProfile task"
}

tasks.closeRepository.doFirst {
println "Executing closeRepository task"
}

tasks.releaseRepository.doFirst {
println "Executing releaseRepository task"
}

// END AI SLOP
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

//apply from: 'http://gradle-plugins.mihosoft.eu/latest/vlicenseheader.gradle'
//repairHeaders.licenseHeaderText = new File(projectDir,'./license-template.txt')

File buildDir = file(".");
Properties props = new Properties()
props.load(new FileInputStream(buildDir.getAbsolutePath()+"/src/main/resources/com/neuronrobotics/javacad/build.properties"))



task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
Expand Down Expand Up @@ -85,31 +119,8 @@ ext {
}


group = "com.neuronrobotics"
archivesBaseName = "JavaCad"
version = props."app.version"
nexusStaging {
packageGroup = 'com.neuronrobotics'
serverUrl='https://oss.sonatype.org/service/local/'
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
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
8 changes: 5 additions & 3 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash
set -e
cat <(echo -e $OSSRH_GPG_SECRET_KEY) | gpg1 --batch --import
gpg1 --list-secret-keys --keyid-format LONG

ls -al $HOME/.gnupg/

echo "app.version=$VERSION_SEMVER" >./src/main/resources/com/neuronrobotics/javacad/build.properties

set -e

./gradlew publish -Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg -Psigning.password=$OSSRH_GPG_SECRET_KEY_PASSWORD -Psigning.keyId=$OSSRH_GPG_SECRET_KEY_ID -PstagingProgressTimeoutMinutes=15
#./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
#./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 closeAndReleaseSeparately -PnexusUsername=$MAVEN_USERNAME -PnexusPassword=$MAVEN_PASSWORD

0 comments on commit 28f45cf

Please sign in to comment.