Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
plugins {
id 'java-library'
id 'idea'
id 'maven-publish'
id 'signing'
id 'com.github.sherter.google-java-format' version '0.9'
id 'com.google.osdetector' version '1.6.0'
id 'java-library'
id 'idea'
id 'maven-publish'
id 'signing'
id 'com.github.sherter.google-java-format' version '0.9'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
id 'com.google.osdetector' version '1.6.0'
}

group 'io.tiledb'
version '0.31.0-SNAPSHOT'

repositories {
mavenCentral()
maven {
url "https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots"
}
}

java {
Expand Down Expand Up @@ -238,16 +236,15 @@ publishing {
}
}
}
}

nexusPublishing {
repositories {
maven {
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv('SONATYPE_CENTRAL_USERNAME')
password System.getenv('SONATYPE_CENTRAL_PASSWORD')
}
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username.set(System.getenv("SONATYPE_CENTRAL_USERNAME"))
password.set(System.getenv("SONATYPE_CENTRAL_PASSWORD"))
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions ci/upload_to_maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ echo "Starting upload to maven"
echo "${GPG_SECRET_KEYS_ENC}" | base64 --decode > $GPG_KEY_LOCATION
./gradlew properties -q | grep "version:" | awk '{print $2}'
export PROJECT_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
# Upload only snapshots to sonatype oss so it can make its way to maven central
./gradlew publishMavenJavaPublicationToMavenRepository

# Only non-snapshot can be pushed as maven releases
# Publish to Sonatype (Central Portal via OSSRH Staging API).
# IMPORTANT: close/release must run in the SAME Gradle invocation so the plugin can reuse the created staging repository id.
if [[ ! $(echo "${PROJECT_VERSION}" | grep "SNAPSHOT") ]]; then
./gradlew closeAndReleaseRepository
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
else
./gradlew publishToSonatype
fi
Loading