Skip to content

Commit

Permalink
Publish snapshot to maven.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Jul 28, 2022
1 parent b4ac4d0 commit a42e97b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
11 changes: 9 additions & 2 deletions java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,15 @@ tasks.withType<Jar> {

publishing {
repositories{
maven {
url = uri("${rootProject.buildDir}/repository")
if (version.toString().endsWith("SNAPSHOT")) {
maven("https://aws.oss.sonatype.org/content/repositories/snapshots/") {
name = "snapshots"
credentials(PasswordCredentials::class)
}
} else {
maven {
uri("${rootProject.buildDir}/repository")
}
}
}
publications {
Expand Down
25 changes: 25 additions & 0 deletions jenkins/publish-snapshot.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pipeline {
agent {
docker {
label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host'
image 'opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2'
args '-e JAVA_HOME=/opt/java/openjdk-11'
alwaysPull true
}
}
stages {
stage('Publish to Maven Staging') {
steps {
git url: 'https://github.com/opensearch-project/opensearch-java.git', branch: 'main'
withCredentials([usernamePassword(credentialsId: 'Sonatype', usernameVariable: 'ORG_GRADLE_PROJECT_snapshotsUsername', passwordVariable: 'ORG_GRADLE_PROJECT_snapshotsPassword')]) {
sh './gradlew --no-daemon publishPublishMavenPublicationToSnapshotsRepository'
}
}
post() {
always {
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
}
}
}
}

0 comments on commit a42e97b

Please sign in to comment.