@@ -89,6 +89,7 @@ pipeline {
8989 stage('Publish project to Maven'){
9090 environment {
9191 SETTINGS = "/home/jenkins/.m2/settings-deploy-ossrh-${PROJECT == 'platform' ? 'releng': PROJECT}.xml"
92+ SONATYPE_BEARER_TOKEN = credentials("central-sonatype-bearer-token")
9293 // The location of the temporarily file that contains the secret file content
9394 // (see https://www.jenkins.io/doc/book/pipeline/syntax/#supported-credentials-type):
9495 KEYRING = credentials("secret-subkeys-${PROJECT == 'platform' ? 'releng': PROJECT}.asc")
@@ -113,7 +114,7 @@ pipeline {
113114 echo "The released version of file "${pomFile}" is already present at $MAVEN_CENTRAL_URL."
114115 fi
115116 else
116- URL=https ://oss.sonatype.org/service/local/staging/deploy/maven2/
117+ URL=file ://$(pwd)
117118 REPO_ID=ossrh # server-id in the settings.xml, used for authentication
118119 MAVEN_CENTRAL_URL=https://repo1.maven.org/maven2/${pomFolder}
119120 echo "Checking ${MAVEN_CENTRAL_URL}"
@@ -153,6 +154,20 @@ pipeline {
153154 -DpomFile=${pomFile} -Dfile=${file} \\
154155 ${SOURCES_ARG} ${JAVADOC_ARG}
155156 done
157+ if [ "${snapshotOrRelease}" == "-release" ]; then
158+ zipFileName="${PROJECT}-artifacts.zip"
159+ zipFileContent="org/eclipse/${PROJECT}"
160+
161+ echo "Zip file ${zipFileName} with from '${zipFileContent}'"
162+ zip -r "${zipFileName}" "${zipFileContent}"
163+
164+ set -x
165+ curl --request POST \
166+ --verbose \
167+ --header "Authorization: Bearer ${SONATYPE_BEARER_TOKEN}" \
168+ --form "bundle=@${zipFileName}" \
169+ 'https://central.sonatype.com/api/v1/publisher/upload'
170+ fi
156171 '''
157172 }
158173 }
0 commit comments