Migrate to new sonatype infrastructure.

This commit is contained in:
Greg L. Turnquist
2021-03-02 13:54:58 -06:00
parent 5d986c2f32
commit b02e9ec9dd
4 changed files with 27 additions and 11 deletions

14
Jenkinsfile vendored
View File

@@ -106,19 +106,15 @@ pipeline {
environment {
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
SONATYPE = credentials('oss-token')
SONATYPE = credentials('oss-login')
KEYRING = credentials('spring-signing-secring.gpg')
PASSPHRASE = credentials('spring-gpg-passphrase')
}
steps {
script {
// Warm up this plugin quietly before using it.
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version'
// Extract project's version number
PROJECT_VERSION = sh(
script: 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO',
script: "ci/version.sh",
returnStdout: true
).trim()
@@ -134,6 +130,12 @@ pipeline {
if (RELEASE_TYPE == 'release') {
sh "PROFILE=central USERNAME=${SONATYPE_USR} PASSWORD=${SONATYPE_PSW} ci/build-and-deploy-to-maven-central.sh ${PROJECT_VERSION}"
slackSend(
color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
channel: '#spring-session-bot',
message: "@here Spring Session for MongoDB ${PROJECT_VERSION} is staged on Sonatype awaiting closure and release.")
} else {
sh "PROFILE=${RELEASE_TYPE} ci/build-and-deploy-to-artifactory.sh"
}

View File

@@ -21,5 +21,5 @@ MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \
-Dmaven.test.skip=true \
-Dgpg.passphrase=${PASSPHRASE} \
-Dgpg.secretKeyring=${GNUPGHOME}/secring.gpg \
-DstagingDescription="Releasing ${PROJECT_VERSION}" \
-DstagingDescription="Releasing Spring Session for MongoDB ${PROJECT_VERSION}" \
clean deploy -B

14
ci/version.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
RAW_VERSION=`MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \
org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
-Dexpression=project.version -q -DforceStdout`
# Split things up
VERSION_PARTS=($RAW_VERSION)
# Grab the last part, which is the actual version number.
echo ${VERSION_PARTS[${#VERSION_PARTS[@]}-1]}

View File

@@ -582,10 +582,10 @@
<extensions>true</extensions>
<configuration>
<serverId>sonatype</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
<keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
<skipStagingRepositoryClose>false</skipStagingRepositoryClose>
<skipStagingRepositoryClose>true</skipStagingRepositoryClose>
</configuration>
</plugin>
</plugins>
@@ -626,7 +626,7 @@
<distributionManagement>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://s01.oss.sonatype.org//service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>